# Drop Down Calculator

## 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>`

##### Share on other sites

Do you still need the second input? are you converting 2 entry datas? or you're comparing? how does it work?

##### Share on other sites

there is an input for the number, and a drop down for the units. there is also a drop down for the units to convert to. then there is a final input that is used as the output.