i am taking a value from user input, lets say $5,000.00
I want to be able take the input and do some simple math to it. i thought it would be best to make the val a string at first and take out any char except a number 0 – 9. is there a faster way to do this?
right now i am taking the amount from a TFmail formail cgi script. The string passes through fine. but, if there are any char’s like ‘$’ or ‘,’ in the string then the output is obviously garbage. what would be the most efficient way to code this for faster page loads? anyway to get around iterating through the entire string?
var str=”{= param.amount =}”;
var amt= 100 + (.01 * parseInt(str));
document.write(amt);