I found the following script somewhere so I can change values to money before
the form is printed. The page works for most people but not some. It worked
fine for me but I get the yellow tri-angle with an exclamation point in the
bottom left part of the window. When I told my IE to display a notification
about every error...it told me there was a problem with line 11.
What is wrong with this?
9 function formatCurrency( strValue)
10 {
11 strValue = strValue.toStri ng().replace(/\$|\,/g,'');
12 dblValue = parseFloat(strV alue);
13 blnSign = (dblValue == (dblValue = Math.abs(dblVal ue)));
14 dblValue = Math.floor(dblV alue*100+0.5000 0000001);
15 intCents = dblValue%100;
16 strCents = intCents.toStri ng();
17 dblValue = Math.floor(dblV alue/100).toString() ;
18 if(intCents<10)
19 strCents = "0" + strCents;
20 for (var i = 0; i < Math.floor((dbl Value.length-(1+i))/3); i++)
21 dblValue = dblValue.substr ing(0,dblValue. length-(4*i+3))+','+
22 dblValue.substr ing(dblValue.le ngth-(4*i+3));
23 return (((blnSign)?'': '-') + '$' + dblValue + '.' + strCents);
}
error message
Line 11
Char 2
Error 'undefined' is null or not an object
code 0
the form is printed. The page works for most people but not some. It worked
fine for me but I get the yellow tri-angle with an exclamation point in the
bottom left part of the window. When I told my IE to display a notification
about every error...it told me there was a problem with line 11.
What is wrong with this?
9 function formatCurrency( strValue)
10 {
11 strValue = strValue.toStri ng().replace(/\$|\,/g,'');
12 dblValue = parseFloat(strV alue);
13 blnSign = (dblValue == (dblValue = Math.abs(dblVal ue)));
14 dblValue = Math.floor(dblV alue*100+0.5000 0000001);
15 intCents = dblValue%100;
16 strCents = intCents.toStri ng();
17 dblValue = Math.floor(dblV alue/100).toString() ;
18 if(intCents<10)
19 strCents = "0" + strCents;
20 for (var i = 0; i < Math.floor((dbl Value.length-(1+i))/3); i++)
21 dblValue = dblValue.substr ing(0,dblValue. length-(4*i+3))+','+
22 dblValue.substr ing(dblValue.le ngth-(4*i+3));
23 return (((blnSign)?'': '-') + '$' + dblValue + '.' + strCents);
}
error message
Line 11
Char 2
Error 'undefined' is null or not an object
code 0
Comment