Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

works in IE but not Mozilla.......

Status
Not open for further replies.

dreamclutch

Programmer
Oct 3, 2005
21
US
I am having difficulties with the javascript below to operate on the Mozilla browser. Works perfect in IE!.

I do know for a fact that after a radio selection is made it DOES alter the price because I get the selected value later on in paypal.

It's not initiating or outputing the text or maybe not initializing the viewprice function correctly? I have the viewprice function in the body.

I'd like this to work in Mozilla because it's becoming fairly popular.


<script language="JavaScript" type="text/JavaScript">
<!--

function viewPrice() {
var rnum = 1;
var subtot=0;
var frm = document.forms['main_form'].elements;
while (cb = frm['R' + rnum]) {
for (var x=0;x<cb.length;x++) {
if (cb[x].checked)
subtot+= cb[x].value-0;
}
rnum++;
}
document.getElementById('SubTotal').innerText = "$" + subtot.toFixed(2);
document.getElementById('Total').innerText = "$" + subtot.toFixed(2);
document.getElementById('amount').value = subtot.toFixed(2);

}
//-->
</script>


<body bgcolor="#F1F8F1" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="viewPrice();">

<form action="cart.php" method=POST name="main_form"><table width="100%" border="0" cellspacing="4" cellpadding="10"><tr bgcolor="#D9E9C9">

<td width="50%" class="body1"><strong>Your Templates</strong></td>
<td class="body1"width="25%"><strong>Remove</strong></td>
<td class="body1" width="25%"><strong>Total</strong></td></tr><tr bgcolor="#E9F2DB">
<td class="body1">Wedding and Nature</td><
td class="body1"><a href='catalog.php?remove=90'><b>Delete</b></a></td>

<td class="body2"><input name="R1" type="radio" value="50.00" onclick="viewPrice()" checked>Non-Exclusive: $50.00 <br><input name="R1" type="radio" value="500.00"onclick="viewPrice()" >Exclusive: $500.00<br>
{We take it off the site} </td></tr><tr bgcolor="#F2F7EA">
<td class="body1">&nbsp;</td><td class="body1">
<div align="right">Subtotal:</div></td>

<td class="body1" id="SubTotal"></td>
</tr>

<tr bgcolor="#F2F7EA">
<td height="39" class="body1">&nbsp;</td>
<td class="body1"><div align="right">Total:</div></td>
<td class="body1" id="Total"></td>

//submit button later on in scipt but is just simple redundant bananas...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top