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> Link to comment https://forums.phpfreaks.com/topic/107873-solved-currency-conversion-help/ 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! Link to comment https://forums.phpfreaks.com/topic/107873-solved-currency-conversion-help/#findComment-553055 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! Link to comment https://forums.phpfreaks.com/topic/107873-solved-currency-conversion-help/#findComment-553479 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.