dreamclutch
Programmer
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"> </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"> </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...
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"> </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"> </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...