From 5ee29e59dbe357474ba8eac6ae02c63a1b841bd2 Mon Sep 17 00:00:00 2001 From: Paul Walko Date: Thu, 13 Nov 2014 14:12:21 -0500 Subject: [PATCH] update --- css/style.css | 33 +++++++++++---- index.html | 101 +++++++++++----------------------------------- js/background2.js | 2 +- js/calculate.js | 25 ++++++++++++ 4 files changed, 74 insertions(+), 87 deletions(-) create mode 100644 js/calculate.js diff --git a/css/style.css b/css/style.css index 3a8eea4..3a3e7bd 100644 --- a/css/style.css +++ b/css/style.css @@ -13,16 +13,33 @@ body{ margin-left: -8px; } #front{ - position: absolute; - top: 200px; - left: 50%; + margin-top: 100px; + /*left: 50%;*/ text-align: center; - margin-left: -585px; - width: 1170px; + margin-left: auto; + margin-right:auto; + width: 300px; font-family: 'Roboto Slab', serif; background-color: white; } -#front > h1{ - margin-top: 0px; - font-size: 122px; +.eq, #result,input,p{ + display: inline; + margin:0px; + padding:0px; +} +#front{ + width: 250px; + margin-left:auto; + margin-right:auto; + margin-top: 20px; + border: 2px solid #a1a1a1; + padding: 10px 40px; + background: #dddddd; + border-radius: 25px; +} +#calculator input, #calculator p{ + width: 100%; +} +.sub{ + font-weight: bold; } \ No newline at end of file diff --git a/index.html b/index.html index ae4d9ce..16a148a 100644 --- a/index.html +++ b/index.html @@ -7,91 +7,36 @@ - - - - RPN Calculator + + Sales Calculator
-

Reverse Polish Notation Calculator

-

*  For Single number operations, only use first field

-
- - - -
     =     
- 0 +

Sales Calculator

+ + +

Computer - $400

+ +

Monitor - $150

+ +

Mouse - $15


+ +

Keyboard - $10


+ +

Ram - $50


+ +

Upgraded Processor - $175


+
+

Subtotal: $

+ 0
+

Tax:          $

+ 0
+

Sales:       $

+ 0

© Paul Walko 2014

- HTML5 Powered with CSS3 / Styling, and Semantics -
diff --git a/js/background2.js b/js/background2.js index e71ec40..dfeb3d5 100644 --- a/js/background2.js +++ b/js/background2.js @@ -1298,4 +1298,4 @@ function perlinNoise(SEED){ -start(); +start(); \ No newline at end of file diff --git a/js/calculate.js b/js/calculate.js new file mode 100644 index 0000000..b46c959 --- /dev/null +++ b/js/calculate.js @@ -0,0 +1,25 @@ +function Calculate(){ + var form = document.getElementById("calculator"); + var total = form.elements["total"]; + var computer = parseInt(form.elements["computer"].value); + var monitor = parseInt(form.elements["monitor"].value); + var mouse = parseInt(form.elements["mouse"].value); + var keyboard = parseInt(form.elements["keyboard"].value); + var ram = parseInt(form.elements["ram"].value); + var processor = parseInt(form.elements["processor"].value); + total.value = ((400 * computer) + (150 * monitor) + (15 * mouse) + (10 * keyboard) + (50 * ram) + (175 * processor)).toFixed(2); + Tax(); + } + function Tax(){ + var form = document.getElementById("calculator"); + var total = parseInt(form.elements["total"].value); + var tax = form.elements["tax"]; + tax.value = (total * .06).toFixed(2); + Total(); + } + function Total(){ + var form = document.getElementById("calculator"); + var total = parseInt(form.elements["total"].value); + var sales = form.elements["sales"]; + sales.value = (total * 1.06).toFixed(2); + } \ No newline at end of file