Metric Converter
Convert from:
cm
m
km
feet
yds
mi
Convert to:
cm
m
km
feet
yds
mi
BY:
vothcom@uniserve.com
...
Voth Communications
DATE:1996-06-28
COMMENTS FROM THE AUTHOR:
The following is for demonstration purposes and no guarantees regarding
the accuracy of the calculations are made.
Source Code
<script language="LiveScript"><!-- // keep track of whether we just computed display.value var computed = false var destination = "http://www.seercom.com/vothcom/" var decimal = 0 function convert (entryform, from, to) { convertfrom = from.selectedIndex convertto = to.selectedIndex entryform.display.value = (entryform.input.value * from[convertfrom].value / to[convertto].value ) } function addChar (input, character) { if((character=='.' && decimal=="0") || character!='.') { (input.value == "" || input.value == "0") ? input.value = character : input.value += character convert(input.form,input.form.measure1,input.form.measure2) computed = true if (character=='.') { decimal=1 } } } function openVothcom() { window.open("","Display window","toolbar=no,directories=no,menubar=no"); } function clear (form) { form.input.value = 0 form.display.value = 0 decimal=0 } function changeBackground(hexNumber) { document.bgColor=hexNumber } // --> </script> <form method="POST" name="calculator"> <table border="1" cellpadding="3"> <tr> <th>Convert from:</th> <td><input size="15" name="input" type="text" onchange="convert(this.form,form.measure1, form.measure2)"></td> <td><select name="measure1" size="1" onchange="convert(this.form,this, form.measure2)"> <option value="0.01" selected>cm <option value="1">m <option value="1000">km <option value="0.3048">feet <option value="0.9144">yds <option value="1610">mi </select> </td> </tr> <tr> <th>Convert to:</th> <td><input size="15" name="display" type="text"></td> <td><select name="measure2" size="1" onchange="convert(this.form,form.measure1, this)"> <option value="0.01">cm <option value="1">m <option value="1000">km <option value="0.3048" selected>feet <option value="0.9144">yds <option value="1610">mi </select> </td> </tr> <tr> <td colspan="3"> <center> <table border="0" cellpadding="2" cellspacing="2"> <tr> <td><input type="button" value="7" onclick="addChar(this.form.input,'7')"></td> <td><input type="button" value="8" onclick="addChar(this.form.input,'8')"></td> <td><input type="button" value="9" onclick="addChar(this.form.input,'9')"></td> </tr> <tr> <td><input type="button" value="4" onclick="addChar(this.form.input,'4')"></td> <td><input type="button" value="5" onclick="addChar(this.form.input,'5')"></td> <td><input type="button" value="6" onclick="addChar(this.form.input,'6')"></td> </tr> <tr> <td><input type="button" value="1" onclick="addChar(this.form.input,'1')"></td> <td><input type="button" value="2" onclick="addChar(this.form.input,'2')"></td> <td><input type="button" value="3" onclick="addChar(this.form.input,'3')"></td> </tr> <tr> <td><input type="button" value="0" onclick="addChar(this.form.input,'0')"></td> <td><input type="button" value="." onclick="addChar(this.form.input,'.')"></td> <td><input type="button" value="C" onclick="clear(this.form)"></td> </tr> </table></center> </td> </tr> </table>
Last updated : September 8, 1998
All materiel : Copyright © 2010 help4web.net
All rights reserved.
© DVDesign