Jump to content

Drop Down Calculator


alphabeta12
 Share

Recommended Posts

i am trying to make a useful calculator that converts metric values using a drop down menu.i just need a value to come up in the second input field.i have know idea what is wrong, but it's mostly a problem with the select boxes.

<body><br><input type="text" name="num1"><select name="unit1"><option value="-9">nm</option><option value="-6">µm</option><option value="-3">mm</option><option value="-2">cm</option><option value="-1">dm</option><option value="0" selected="selected">m</option><option value="1">dam</option><option value="2">hm</option><option value="3">km</option><option value="6">Mm</option><option value="9">Gm</option><option value="12">Tm</option></select><br><input type="button" value="convert" onclick="document.num2.value=(math.pow(10,(document.unit1.value-document.unit2.value)))*document.num1.value"><br><input type="text" name="num2"><select name="unit2"><option value="-9">nm</option><option value="-6">µm</option><option value="-3">mm</option><option value="-2">cm</option><option value="-1">dm</option><option value="0" selected="selected">m</option><option value="1">dam</option><option value="2">hm</option><option value="3">km</option><option value="6">Mm</option><option value="9">Gm</option><option value="12">Tm</option></select></body>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...