...

View Full Version : Javascript not workin in Firefox or Chrome



fulltiltphil
03-16-2012, 04:10 PM
This is a JavaScript sample that works with Internet Explorer and Safari, but not with FireFox and Chrome. If you take the code and save it as test.html open the file with explorer or Safari you will see it works. This is the first time of posted on this forum, sorry if I missed any information. This form posts to a InternetSecure(payment gateway) Sandbox account.

[CODE]
<head>

<title>Variable Payment - JavaScript</title>

</head>

<script language="javascript">

function getamount()

{

prod = "::1::P001::Sample Payment::";

pvalue = document.getElementsByName("payvalue")(0).value;

amount = pvalue + prod;

document.frmdo.Products.value = amount;

}

</script>



<body>



<table align="center" width="600">

<tr>

<td align="center" valign="middle"><big>View Source For HTML Code<br></big><em><strong>Variable Payment - JavaScript</strong></em><br /></td>

</tr>

</table>



<td align="center" valign="top">



<FORM method=post name="frmdo" action="https://test.internetsecure.com/process.cgi" onsubmit="return getamount();">

<input type="hidden" name="GatewayID" value="106" />

<input type="hidden" name="ReturnURL" value="https://testwww.internetsecure.com/merchants/Demopage.asp?page=THK2" />

<input type="hidden" value="https://testwww.internetsecure.com/merchants/Demopage.asp?page=SAM1" name="xxxCancelURL" />

<input type="hidden" name="Products" value="" />



<table align="center" width="600">

<tr>

<td width="300" height="100%" align="right" valign="middle"><font face="Arial, Helvetica, sans-serif" size="2" color="Black">Invoice Number</font></td>

<td width="300" height="100%" align="left" valign="middle"><input type="text" id="Invoice Number" name="xxxMerchantInvoiceNumber" size="8" /></td>

</tr>



<tr>

<td width="300" height="100%" align="right" valign="Middle"><font face="Arial, Helvetica, sans-serif" size="2" color="Black">Payment Amount $</font></td>

<td width="300" height="100%" align="left" valign="middle"><input type="text" name="payvalue" value="" size=10 style="text-align:right;" />

<font face="Arial, Helvetica, sans-serif" size="2" color="Black"> USD</font></td>

</tr>

</table>



<table align="center" width="600">

<tr>

<td width="600" height="100%" align="center" valign="middle"><input type="submit" value="Submit Payment" name="submit" /></td>

</tr>

</table>



<table align="center" width="600">

<tr>

<td width="600" height="100%" align="center" valign="middle">

<!-- Copy this Grahpic to your Host and change the URL to point to your server --><IMG ALIGN=CENTER SRC="https://secure.internetsecure.com/images/visa04.gif" WIDTH=37 HEIGHT=23>

<!-- Copy this Grahpic to your Host and change the URL to point to your server --><IMG ALIGN=CENTER SRC="https://secure.internetsecure.com/images/mc04.gif" WIDTH=37 HEIGHT=23>

<!-- Copy this Grahpic to your Host and change the URL to point to your server --><IMG ALIGN=CENTER SRC="https://secure.internetsecure.com/images/amex04.gif" WIDTH=37 HEIGHT=23>

<!-- Copy this Grahpic to your Host and change the URL to point to your server --><IMG ALIGN=CENTER SRC="https://secure.internetsecure.com/images/disc04.gif" WIDTH=37 HEIGHT=23>

</td>

</tr>

</table>

<table align="center" width="600">

<tr>

<td width="600" height="100%" align="center" valign="middle"><a target="_blank" href="https://testwww.internetsecure.com/cgi-bin/certified.mhtml?merchant_number=106"><img height="33" border="0" align="center" width="98" alt="" src="https://testwww.internetsecure.com/images/ismerch_sm.gif" /></a></td>

</tr>

</table>

</form>
[CODE]

Philip M
03-16-2012, 04:54 PM
Change the script to:-


<script type = "text/javascript">

function getamount(){
var prod = "::1::P001::Sample Payment::";
var pvalue = document.frmdo.payvalue.value;
var amount = pvalue + prod;
document.frmdo.Products.value = amount;
}

</script>


"That which seems the height of absurdity in one generation often becomes the height of wisdom in the next". - John Stuart Mill.

fulltiltphil
03-16-2012, 05:32 PM
That worked! Thank you!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum