OZONE Asylum
Forums
DHTML/Javascript
Decimal to Binary Conversion
This page's ID:
28070
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
Having some trouble with this one. [code]<html> <head> <script language="Javascript" type="text/javascript"> function ConvertBinary() { var originalnumber = 0; var resultnumber = 0; var resulstring = ""; if (document.form1.dropdown.value == "dectobin") { originalnumber = document.form1.original1.value; for (i = 1000; i > 1; i--) { if (( originalnumber - Math.pow(2,i) > 0) { resultstring+="1" } if (( originalnumber - Math.pow(2,i) < 1{ resultstring+="0" } } document.form1.result1.value=resultstring; } } error(1): wrong syntax </script> </head> <body> <center> <form name="form1" onsubmit="return false;"> Input:<input type="text" name="original1" value=""> Output:<input type="text" name="result1"><p> <select name="dropdown"> <option value="dectobin">Decimal to Binary <option value="bintodec">Binary to Decimal </select><br> <input type="button" onClick="ConvertBinary();" value="Convert Number!"> </center> </form> </body> </html>[/code] Not quite sure what the problem is,<html> [small](Edited by [url=http://www.ozoneasylum.com/user/6200]Hutch[/url] on 06-13-2006 07:04)[/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »