Hi, I am NOT very fluent in JavaScript, so I apologize upfront if this appears silly.
I took over the design/development of a website and it had a page created using asp, which I had to convert to php. But now the JavaScript doesn’t seem to work.
The error I keep getting in IE is:
Message: Object expected
Line: 96
Char: 1
Code: 0
The html code that calls the function is as follows:
<input type="radio" name="donationAmount" id="donationAmount" value="10.00">
<input type="radio" name="donationAmount" id="donationAmount" value="20.00">
<input type="radio" name="donationAmount" id="donationAmount" value="30.00">
<input type="radio" name="donationAmount" id="donationAmount" value="40.00">
<input type="submit" value="Paypal" onclick="submitform('paypal');">
<input type="submit" value="Paygate" onclick="submitform('paygate');">
And the JavaScript function is like this:[FONT=monospace]
[/FONT]
<script>
function submitform(whichform)
{
document.forms['paypalform'].amount.value = getRadioValue();
document.forms['paygateform'].AMOUNT.value = parseFloat(getRadioValue().replace('.','')* 7.4);
if (whichform == 'paypal')
{
document.forms['paypalform'].submit();
}
else {
document.forms['paygateform'].submit();
}
}
function getRadioValue() {
for (index=0; index < document.amounts.donationAmount.length; i++) {
if (document.amounts.donationAmount*.checked) {
var radioValue = document.amounts.donationAmount*.value;
break;
}
}
return radioValue;
}
</script>
[FONT=monospace]
[/FONT]If anyone can help me or point me in the right direction, I would be so grateful. Thank you very much!