From 533ba6e1ee1a217bb3335768a789fa7bdcd8aad3 Mon Sep 17 00:00:00 2001 From: Pavel Khudyakov Date: Thu, 15 Nov 2012 13:24:55 +0600 Subject: [PATCH] dz4-jscalc --- calc/index.html | 20 ++++++++++++++++++++ calc/script.js | 7 +++++++ calc/style.css | 45 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 calc/index.html create mode 100644 calc/script.js create mode 100644 calc/style.css diff --git a/calc/index.html b/calc/index.html new file mode 100644 index 0000000..ff7cd94 --- /dev/null +++ b/calc/index.html @@ -0,0 +1,20 @@ + + + + + Calc + + + + +
+ +
+ +
+
+ +
+
+ + \ No newline at end of file diff --git a/calc/script.js b/calc/script.js new file mode 100644 index 0000000..fa72f86 --- /dev/null +++ b/calc/script.js @@ -0,0 +1,7 @@ +function addChar(character) { + document.clacForm.calcDisp.value = document.clacForm.calcDisp.value + character; +} + +function calc() { + document.clacForm.calcDisp.value = eval(document.clacForm.calcDisp.value); +} \ No newline at end of file diff --git a/calc/style.css b/calc/style.css new file mode 100644 index 0000000..803c822 --- /dev/null +++ b/calc/style.css @@ -0,0 +1,45 @@ +div, form, input { + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +form { + overflow: hidden; + margin: auto; + width: 287px; + height: 377px; +} + +input[type="text"] { + width: 285px; + height: 75px; + border: 1px solid #000; + text-align: right; + font-size: xx-large; + padding-right: .5em; +} + +input[type="button"] { + border-top: 0; + border-right: 0; + border-bottom: 1px solid #000; + border-left: 1px solid #000; + background-color: #FFF; + font-size: x-large; +} + +.num { + float: left; + width: 225px; +} + +.num input[type="button"] { + width: 75px; + height: 75px; +} + +.opt input[type="button"] { + width: 60px; + height: 60px; + border-right: 1px solid #000; +} \ No newline at end of file