diff options
author | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2020-12-03 09:32:13 +0700 |
---|---|---|
committer | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2020-12-03 09:32:13 +0700 |
commit | 8644699f4d2fce12a41289f9627bc45be9dd1965 (patch) | |
tree | d31190ac36d10e297eeab0f6e7a70dc24395695d /usth/ICT3.2/prac/2/11.html | |
parent | 82048ad9e3e4a96a38c8fa6a529798f40e33acb1 (diff) | |
download | cp-8644699f4d2fce12a41289f9627bc45be9dd1965.tar.gz |
[usth/ICT3.2] Develop web applications
Diffstat (limited to 'usth/ICT3.2/prac/2/11.html')
-rw-r--r-- | usth/ICT3.2/prac/2/11.html | 55 |
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: </label> + <input class=cell type=text id=1st> + </p> + <p> + <label class=cell for=2nd>2nd Number: </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: </span> + <span id=result></span> + </p> + </form> +</body> +</html> |