mestes
12-13-2004, 04:50 AM
I have a javascript that functions properly but I get an error at the bottom of browser in IE
Here is the script
<script language="JavaScript" type="text/JavaScript">
<!--
function settax(Info){
if(Info.state.value == ""){return false;}<<<---Line 25 from error code
if(Info.state.value == "MA"){
Info.tax.value = 5;
}else{
Info.tax.value = 0;
}
recalculate(Info);
return false;
}
function recalculate(Info){
var qty = parseInt(Info.qty.value);
if(isNaN(qty)) qty = 0;
var price = parseFloat(Info.price.value);
var shiphand = parseFloat(Info.shiphand.value);
var shiphand = 3.00;
var tax = parseFloat(Info.tax.value) * .01;
price *= qty;
shiphand = (qty > 1)?(shiphand + ((qty - 1) * 1.5)):(qty == 1)?(shiphand):(0);
tax *= price;
Info.shiphand.value = (3.00 + ((Info.qty.value - 1) * 1.50)).toFixed(2);
Info.total.value = (price + tax + shiphand).toFixed(2);
}
//-->
onLoad = settax(document.buynow);
</script>
The error in IE reads like this
Line: 25
Char:2
Error:'state' is not null or not an object
Code:0
URL:
Now in the script above I labeled line 25 of the script.
Can anyone tell me how to keep the script working but not have that error.
Thanks
Here is the script
<script language="JavaScript" type="text/JavaScript">
<!--
function settax(Info){
if(Info.state.value == ""){return false;}<<<---Line 25 from error code
if(Info.state.value == "MA"){
Info.tax.value = 5;
}else{
Info.tax.value = 0;
}
recalculate(Info);
return false;
}
function recalculate(Info){
var qty = parseInt(Info.qty.value);
if(isNaN(qty)) qty = 0;
var price = parseFloat(Info.price.value);
var shiphand = parseFloat(Info.shiphand.value);
var shiphand = 3.00;
var tax = parseFloat(Info.tax.value) * .01;
price *= qty;
shiphand = (qty > 1)?(shiphand + ((qty - 1) * 1.5)):(qty == 1)?(shiphand):(0);
tax *= price;
Info.shiphand.value = (3.00 + ((Info.qty.value - 1) * 1.50)).toFixed(2);
Info.total.value = (price + tax + shiphand).toFixed(2);
}
//-->
onLoad = settax(document.buynow);
</script>
The error in IE reads like this
Line: 25
Char:2
Error:'state' is not null or not an object
Code:0
URL:
Now in the script above I labeled line 25 of the script.
Can anyone tell me how to keep the script working but not have that error.
Thanks