73 lines
No EOL
2.3 KiB
HTML
73 lines
No EOL
2.3 KiB
HTML
<html>
|
|
<head>
|
|
<title>Byte Converter</title>
|
|
<meta name="viewport" content="width=240">
|
|
<style>
|
|
body { margin:0px; height:176px; width:240px; overflow:hidden; }
|
|
input {
|
|
font-size:8px;
|
|
}
|
|
</style>
|
|
<script type="text/javascript">
|
|
/* This script and many more are available free online at
|
|
The JavaScript Source :: http://javascript.internet.com
|
|
Created by: Uncle Jim :: http://jdstiles.com/javamain.html */
|
|
|
|
function convert(f) {
|
|
f.kb.value=Math.round(f.byte.value/1024*100000)/100000
|
|
f.mb.value=Math.round(f.byte.value/1048576*100000)/100000
|
|
f.gb.value=Math.round(f.byte.value/1073741824*100000)/100000
|
|
}
|
|
|
|
function convertkb(f) {
|
|
f.byte.value=Math.round(f.kb.value*1024*100000)/100000
|
|
f.mb.value=Math.round(f.kb.value/1024*100000)/100000
|
|
f.gb.value=Math.round(f.kb.value/1048576*100000)/100000
|
|
}
|
|
|
|
function convertmb(f) {
|
|
f.byte.value=Math.round(f.mb.value*1048576*100000)/100000
|
|
f.kb.value=Math.round(f.mb.value*1024*100000)/100000
|
|
f.gb.value=Math.round(f.mb.value/1024*100000)/100000
|
|
}
|
|
|
|
function convertgb(f) {
|
|
f.byte.value=Math.round(f.gb.value*1073741824*100000)/100000
|
|
f.kb.value=Math.round(f.gb.value*1048576*100000)/100000
|
|
f.mb.value=Math.round(f.gb.value*1024*100000)/100000
|
|
}
|
|
</script>
|
|
</head>
|
|
<body bgcolor=darkorange>
|
|
<div align=center>
|
|
<form>
|
|
<table id="example" cellpadding="0" cellspacing="0" border=0 width=240>
|
|
<tr>
|
|
<td align="center">Byte</td>
|
|
<td align="center">Kilobyte</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center"><input type="text" size="10" name="byte" value="0"></td>
|
|
<td align="center"><input type="text" size="10" name="kb" value="0"></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center"><input type="button" name="B2" value=" > " onClick="convert(this.form)"></td>
|
|
<td align="center"><input type="button" name="B22" value=" < > " onClick="convertkb(this.form)"></td>
|
|
<tr height=30><td></td></tr>
|
|
<tr>
|
|
<td align="center">Megabyte</td>
|
|
<td align="center">Gigabyte</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center"><input type="text" size="10" name="mb" value="0"></td>
|
|
<td align="center"><input type="text" size="10" name="gb" value="0"></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center"><input type="button" name="B23" value=" < > " onClick="convertmb(this.form)"></td>
|
|
<td align="center"><input type="button" name="B24" value=" < " onClick="convertgb(this.form)"></td>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
</div>
|
|
</body>
|
|
</html> |