PREMENY JEDNOTIEK

ID
Nazov / Name:
Popis / Description:
Dlzka / Length:
Testovane pod / Tested under:

 

094
p094.html / p094.zip
Prevody medzi rozlicnymi jednotkami
2708b
NN 4.04, IE 4.0

UKAZKA / CLICK HERE

Zdrojovy tvar / Source code:

<HTML> <HEAD> <TITLE> JavaScript DESTINATION - P094 </TITLE> <SCRIPT LANGUAGE="JavaScript"> <!-- var computed = false 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 clear (form) { form.input.value = 0 form.display.value = 0 decimal=0 } // --> </SCRIPT> </HEAD> <BODY> <H2>Premena jednotiek</H2> <FORM METHOD="POST" NAME="calculator"> <TABLE BORDER="3" CELLPADDING="3"> <TR><TH>Premenit:</TH> <TD><INPUT SIZE="15" NAME="input" ONCHANGE="convert(this.form,form.measure1, form.measure2)"></TD> <TD> <SELECT NAME="measure1" 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">stopy <OPTION VALUE="0.9144">yardy <OPTION VALUE="1610">mile </SELECT> </TD> <TR><TH>na:</TH> <TD><INPUT SIZE="15" NAME="display"></TD> <TD> <SELECT NAME="measure2" 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>stopy <OPTION VALUE="0.9144">yardy <OPTION VALUE="1610">mile </SELECT> </TD> </TABLE> <TABLE BORDER="3" CELLPADDING="3"> <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><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><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><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 ROWSPAN=""><INPUT TYPE="button" VALUE="C" ONCLICK="clear(this.form)"><TD> </TABLE> </FORM> </BODY> </HTML>
[ Navrat / BACK ]