about summary refs log tree commit diff stats
path: root/tutorial/converter.html
blob: dca1190cd69e494bc31e147a2817af878a40c3b0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<script>
function convert() {
  var n = parseInt(document.getElementById('input').value);
  if (isNaN(n))
    document.getElementById('result').innerHTML = "not a number";
  else
    document.getElementById('result').innerHTML = "0x" + n.toString(16);
  event.preventDefault();
}
</script>
<body style='font-size:200%'>
<form style='margin:5em' onSubmit='convert()'>
<input style='width:4em; font-size:100%' type='text' id='input'/> <input type='submit' style='width=6em; font-size:100%' value='convert'> = <span id='result' style='display:inline-block; min-width:4em; border-bottom:1px solid; text-align: right'></span>
</form>
</body>