update
parent
072b3dc0c9
commit
5ee29e59db
|
@ -13,16 +13,33 @@ body{
|
||||||
margin-left: -8px;
|
margin-left: -8px;
|
||||||
}
|
}
|
||||||
#front{
|
#front{
|
||||||
position: absolute;
|
margin-top: 100px;
|
||||||
top: 200px;
|
/*left: 50%;*/
|
||||||
left: 50%;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin-left: -585px;
|
margin-left: auto;
|
||||||
width: 1170px;
|
margin-right:auto;
|
||||||
|
width: 300px;
|
||||||
font-family: 'Roboto Slab', serif;
|
font-family: 'Roboto Slab', serif;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
}
|
}
|
||||||
#front > h1{
|
.eq, #result,input,p{
|
||||||
margin-top: 0px;
|
display: inline;
|
||||||
font-size: 122px;
|
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;
|
||||||
}
|
}
|
101
index.html
101
index.html
|
@ -7,91 +7,36 @@
|
||||||
<script src="js/jquery.js"></script>
|
<script src="js/jquery.js"></script>
|
||||||
<script src="js/two.min.js"></script>
|
<script src="js/two.min.js"></script>
|
||||||
<script src="js/randomColor.js"></script>
|
<script src="js/randomColor.js"></script>
|
||||||
|
<script src="js/calculate.js"></script>
|
||||||
<style type="text/css">
|
<title>Sales Calculator</title>
|
||||||
.eq, #result, p {
|
|
||||||
display: inline;
|
|
||||||
margin:0px;
|
|
||||||
padding:0px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript">
|
|
||||||
function Calculate(){
|
|
||||||
var form = document.getElementById("calculator");
|
|
||||||
var output = form.elements["c"];
|
|
||||||
var a = parseInt(form.elements["a"].value);
|
|
||||||
var b = parseInt(form.elements["b"].value);
|
|
||||||
var op = parseInt(form.elements["selector"].value);
|
|
||||||
switch(op){
|
|
||||||
case 0:
|
|
||||||
output.value = a * b;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
output.value = a / b;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
output.value = a + b;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
output.value = a - b;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
output.value = Math.log(a);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
output.value = Math.pow(a, b);
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
output.value = Math.tan(a);
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
output.value = Math.cos(a);
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
output.value = Math.sin(a);
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
output.value = Math.abs(a);
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
output.value = Math.exp(a);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<title>RPN Calculator</title>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<canvas id="screen">
|
<canvas id="screen">
|
||||||
</canvas>
|
</canvas>
|
||||||
<div id="front">
|
<div id="front">
|
||||||
<h2>Reverse Polish Notation Calculator</h2>
|
<h2>Sales Calculator</h2>
|
||||||
<p>* For Single number operations, only use first field</p>
|
<form id="calculator" oninput="Calculate()">
|
||||||
<form id="calculator" oninput="Calculate()">
|
<input name="computer" type="number" value="0" />
|
||||||
<input name="a" type="number" value="0"/>
|
<p>Computer - $400</p>
|
||||||
<input name="b" type="number" value="0"/>
|
<input name="monitor" type="number" value="0"/>
|
||||||
<select name="selector" onchange="Calculate()">
|
<p>Monitor - $150</p>
|
||||||
<option value="-1">Select an Operation</option>
|
<input name="mouse" type="number" value="0"/>
|
||||||
<option value="0">*</option>
|
<p>Mouse - $15</p><br/>
|
||||||
<option value="1">/</option>
|
<input name="keyboard" type="number" value="0"/>
|
||||||
<option value="2">+</option>
|
<p>Keyboard - $10</p><br/>
|
||||||
<option value="3">-</option>
|
<input name="ram" type="number" value="0"/>
|
||||||
<option value="4">log</option>
|
<p>Ram - $50</p><br/>
|
||||||
<option value="5">^</option>
|
<input name="processor" type="number" value="0"/>
|
||||||
<option value="6">tan</option>
|
<p>Upgraded Processor - $175</p><br/>
|
||||||
<option value="7">cos</option>
|
<br/>
|
||||||
<option value="8">sin</option>
|
<p class="sub">Subtotal: $</p>
|
||||||
<option value="9">abs</option>
|
<output name="total" for="computer monitor mouse keyboard ram monitor">0</output><br/>
|
||||||
<option value="10">e^x</option>
|
<p class="sub">Tax: $</p>
|
||||||
</select>
|
<output name="tax" for="computer monitor mouse keyboard ram monitor">0</output><br/>
|
||||||
<div class="eq"> = </div>
|
<p class="sub">Sales: $</p>
|
||||||
<output id="result" name="c" for="x y">0</output>
|
<output name="sales" for="computer monitor mouse keyboard ram monitor">0</output><br/>
|
||||||
</form>
|
</form>
|
||||||
<h4> © Paul Walko 2014</h4>
|
<h4> © Paul Walko 2014</h4>
|
||||||
<a href="http://www.w3.org/html/logo/"><img src="http://www.w3.org/html/logo/badge/html5-badge-h-css3-semantics.png" width="165" height="64" alt="HTML5 Powered with CSS3 / Styling, and Semantics" title="HTML5 Powered with CSS3 / Styling, and Semantics">
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript" src="js/background2.js"></script>
|
<script type="text/javascript" src="js/background2.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -1298,4 +1298,4 @@ function perlinNoise(SEED){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
start();
|
start();
|
|
@ -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);
|
||||||
|
}
|
Loading…
Reference in New Issue