about summary refs log tree commit diff
path: root/usth/ICT3.2/prac/2/11.html
diff options
context:
space:
mode:
Diffstat (limited to 'usth/ICT3.2/prac/2/11.html')
-rw-r--r--usth/ICT3.2/prac/2/11.html55
1 files changed, 55 insertions, 0 deletions
diff --git a/usth/ICT3.2/prac/2/11.html b/usth/ICT3.2/prac/2/11.html
new file mode 100644
index 0000000..51c0922
--- /dev/null
+++ b/usth/ICT3.2/prac/2/11.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<style>
+h1 { text-align: center }
+form {
+    display: table;
+    margin: 0 auto;
+}
+p { display: table-row }
+.cell {
+    display: table-cell;
+    margin: 0.2em 0;
+}
+</style>
+
+<script>
+function get() {
+    return [document.getElementById('1st').value,
+            document.getElementById('2nd').value];
+}
+
+function mul() {
+    document.getElementById('result').innerHTML = (
+        (x, y) => x * y)(...get());
+}
+
+function div() {
+    document.getElementById('result').innerHTML = (
+        (x, y) => x / y)(...get());
+}
+</script>
+
+<html>
+<body>
+  <form>
+    <p>
+      <label class=cell for=1st>1st Number:&emsp;</label>
+      <input class=cell type=text id=1st>
+    </p>
+    <p>
+      <label class=cell for=2nd>2nd Number:&emsp;</label>
+      <input class=cell type=text id=2nd>
+    </p>
+    <p>
+      <span class=cell></span>
+      <span class=cell>
+        <input type=button onclick='mul()' value=Multiply>
+        <input type=button onclick='div()' value=Divide>
+      </span>
+    <p>
+      <span class=cell>The Result is:&emsp;</span>
+      <span id=result></span>
+    </p>
+  </form>
+</body>
+</html>