about summary refs log tree commit diff stats
path: root/tutorial/converter.html
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-10-20 12:25:06 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-10-20 12:25:06 -0700
commit9320a557f759d0c5b70982fd1b7eaabd3d7ce3f6 (patch)
tree0401c0d1cd617e2c93cd0544de4b5fe3e5fd65c3 /tutorial/converter.html
parent619dc31dfc565a2f8d76b6ab701b64394506f5ae (diff)
downloadmu-9320a557f759d0c5b70982fd1b7eaabd3d7ce3f6.tar.gz
.
Diffstat (limited to 'tutorial/converter.html')
-rw-r--r--tutorial/converter.html15
1 files changed, 15 insertions, 0 deletions
diff --git a/tutorial/converter.html b/tutorial/converter.html
new file mode 100644
index 00000000..dca1190c
--- /dev/null
+++ b/tutorial/converter.html
@@ -0,0 +1,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>