<FORM name=bandwidth> <P><INPUT value=1024 name=original> <SELECT size=1 name=units> <OPTION value=Bytes selected>Bytes</OPTION> <OPTION value=Kb>Kb</OPTION> <OPTION value=Mb>Mb</OPTION> <OPTION value=Gb>Gb</OPTION></SELECT> <INPUT onclick=calculate() type=button value=Átszámítás name=B1></P></FORM> <P> <SCRIPT>
var bytevalue=0 function calculate(){ var invalue=document.bandwidth.original.value var selectunit=document.bandwidth.units.options[document.bandwidth.units.selectedIndex].value if (selectunit=="Bytes") bytevalue=invalue else if (selectunit=="Kb") bytevalue=invalue*1024 else if (selectunit=="Mb") bytevalue=invalue*1024*1024 else if (selectunit=="Gb") bytevalue=invalue*1024*1024*1024
alert (invalue+" "+selectunit+" pontosan ennyi:\n\n- "+bytevalue+" Bytes\n- "+Math.round(bytevalue/1024)+" Kb\n- "+Math.round(bytevalue/1024/1024)+" Mb\n- "+Math.round(bytevalue/1024/1024/1024)+" Gb\n") }
</SCRIPT> |