ibda12u Posted May 29, 2008 Share Posted May 29, 2008 Hello, I'm getting a javascript error when I run the following code on my page. I am at a total lost, can anyone point me in the right direction, so I can figure what is causing the error? Pretty much this is supposed to be a simple currency convertor. Thanks, Ibda <head> <title>Money Exchange</title> <script language="JavaScript"> <!-- function convert() { var amt = parseFloat(exchange.amount.value); var euro = Math.round((amt * .0.636821) * 100) / 100; document.write(exchange.amount.value + " dollars is " + euro + " Euros"); } //--> </script> </head> <body> <form name="exchange" action="javascript:convert()" method="post"> Amount to convert <input type="text" name="amount"><br/><br> <input type="radio" name="RBgender" value="euro" id="radio1">Euro to Dollar<br> <input type="radio" name="RBgender" value="dollar" id="radio2">Dollar to Euro<br><br> <input type="submit" value="Submit Form"> </form> </body> </html> Quote Link to comment Share on other sites More sharing options...
Psycho Posted May 29, 2008 Share Posted May 29, 2008 Here's the problem: var euro = Math.round((amt * .0.636821) * 100) / 100; Remove the extra decimal! Quote Link to comment Share on other sites More sharing options...
ibda12u Posted May 30, 2008 Author Share Posted May 30, 2008 Thank you so much, I guess I'd just been looking at it too long! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.