1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
<html>
<head>
<title>
DBm Converter
</title>
<script type="text/javascript">
<!--
function convert()
{
if (document.getElementById)
{
var db = document.getElementById('dbmid').value;
var But = document.getElementById('utid');
var ut = 4.0 * Math.PI * Math.pow(10.0, ((db + 36)/20));
res = (Math.round (ut *100))/100;
But.value=res;
}
}
function bar()
{
var dbm=1
while(--dbm > -50)
{
document.body.appendChild(document.createTextNode(dbm +" => " + 4.0 * Math.PI * Math.pow(10.0, ((dbm + 36)/20)) ))
document.body.appendChild(document.createElement('br'))
}
}
//-->
</script>
</head>
<body onload="bar()">
DBm: <input type="text" name="dbmid" value="" /><br />
µT: <input type="text" name="utid" value="" /><br />
<input type="submit" value="Convert" onClick="convert()" />
</body>
</html> |
Partager