just wondering if I could get some help. Driving myself crazy over something which I'm sure is easy peasy! :(
Basically I'm trying to get a calculator that will calculate two variables. I've kind of got this working by hook or by crook....
But the numbers I put in will be copy and pasted from somewhere else, and thus will more than likely have a comma in it to separate eg one thousand will be 1,000.00 (possible whitespace after value).
This breaks my calculator giving a result of "nAn" and I can't seem to find a work around. Would anyone be able to assist?
Thanks very much.
My code thus far:
<HTML>
<HEAD>
<TITLE>calc</TITLE>
<SCRIPT language="javascript" type="text/javascript">
function division() {
a=Number(document.calculator.number1.value);
b=Number(document.calculator.number2.value);
c=(a/b)*10000;
document.calculator.total.value=c;
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name="calculator">
First input: <INPUT type="text" name="number1"> <br>
Second input: <INPUT type="text" name="number2"> <br>
<INPUT type="button" value="Calculate" onclick="javascript:division();">
Total: <INPUT type="text" name="total"> <br>
</FORM>
</BODY>
</HTML>