Why is it that when I change the '+' to a '*' in the following:- totAdd=(theForm.amount.value-0.0)+(totAdd-0.0);
that the final result ends in an error? This is part of a shopping cart that passes info to paypal I receivethe following message "The link you have used to enter the PayPal system contains an incorrectly formatted item amount." the + works fine
<script Language="JavaScript">
<!--
function formvalidator<%=Count%>(theForm)
{
var tStr,aStr,totAdd=0.0;
<%
for rowcounter=0 to 1
if Int(rs("pOptionGroup"&rowcounter)) <> 0 then
response.write "if(theForm.xs"&rowcounter&".selectedIndex==0){alert('Please chose from the available product options.');"&vbCrLf
response.write "theForm.xs"&rowcounter&".focus();"&vbCrLf
response.write "return (false);}"&vbCrLf
response.write "tStr=theForm.xs"&rowcounter&"[theForm.xs"&rowcounter&".selectedIndex].value;"&vbCrLf
response.write "aStr=tStr.split('|');"&vbCrLf
response.write "totAdd+=(aStr[0]-0.0);"&vbCrLf
response.write "theForm.os"&rowcounter&".value=tStr.substring(tStr.indexOf('|')+1);"&vbCrLf
end if
next
%>
totAdd=(theForm.amount.value-0.0)+(totAdd-0.0);
tStr=totAdd.toString()
if(tStr.indexOf(".")==-1)
tStr=tStr+".00"
else if((tStr.length-tStr.indexOf("."))==2)
tStr=tStr+"0";
theForm.amount.value=tStr;
return (true);
}
//-->
</script>
that the final result ends in an error? This is part of a shopping cart that passes info to paypal I receivethe following message "The link you have used to enter the PayPal system contains an incorrectly formatted item amount." the + works fine
<script Language="JavaScript">
<!--
function formvalidator<%=Count%>(theForm)
{
var tStr,aStr,totAdd=0.0;
<%
for rowcounter=0 to 1
if Int(rs("pOptionGroup"&rowcounter)) <> 0 then
response.write "if(theForm.xs"&rowcounter&".selectedIndex==0){alert('Please chose from the available product options.');"&vbCrLf
response.write "theForm.xs"&rowcounter&".focus();"&vbCrLf
response.write "return (false);}"&vbCrLf
response.write "tStr=theForm.xs"&rowcounter&"[theForm.xs"&rowcounter&".selectedIndex].value;"&vbCrLf
response.write "aStr=tStr.split('|');"&vbCrLf
response.write "totAdd+=(aStr[0]-0.0);"&vbCrLf
response.write "theForm.os"&rowcounter&".value=tStr.substring(tStr.indexOf('|')+1);"&vbCrLf
end if
next
%>
totAdd=(theForm.amount.value-0.0)+(totAdd-0.0);
tStr=totAdd.toString()
if(tStr.indexOf(".")==-1)
tStr=tStr+".00"
else if((tStr.length-tStr.indexOf("."))==2)
tStr=tStr+"0";
theForm.amount.value=tStr;
return (true);
}
//-->
</script>