diff options
| author | Unknown <Alee14498@gmail.com> | 2017-10-01 00:24:20 -0400 |
|---|---|---|
| committer | Unknown <Alee14498@gmail.com> | 2017-10-01 00:24:20 -0400 |
| commit | 78f3c0e9893d36e0ce039c2b79ede8a92ebe468a (patch) | |
| tree | 8479930f9372a1e9998b6750651565cf52b81ca8 /apps/calculator/scientific.html | |
| parent | d8ba59582c137de474789690e777d8c029e08fe6 (diff) | |
| download | windows8online-78f3c0e9893d36e0ce039c2b79ede8a92ebe468a.tar.gz windows8online-78f3c0e9893d36e0ce039c2b79ede8a92ebe468a.tar.bz2 windows8online-78f3c0e9893d36e0ce039c2b79ede8a92ebe468a.zip | |
Adding the code
Diffstat (limited to 'apps/calculator/scientific.html')
| -rw-r--r-- | apps/calculator/scientific.html | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/apps/calculator/scientific.html b/apps/calculator/scientific.html new file mode 100644 index 0000000..86d5559 --- /dev/null +++ b/apps/calculator/scientific.html @@ -0,0 +1,130 @@ +<html> +<head> + <meta http-equiv="x-ua-compatible" content="IE=edge"> + <title>Calculator</title> + <link rel="stylesheet" href="style.css"> + <link rel="stylesheet" href="common.css"> + <link rel="shortcut icon" href="favicon32.ico" size="32x32"> + <script> + function charms(){ + document.getElementById('charmsbar').style.display='block'; + document.getElementById('datetime').style.display='block'; + } + function destroycharms() { + document.getElementById('charmsbar').style.display='none'; + document.getElementById('datetime').style.display='none'; + } + function start(){ + document.getElementById('startbutton').style.display='block'; + } + function destroystart() { + document.getElementById('startbutton').style.display='none'; + } + </script> +</head> +<body> + <script language="javascript" type="text/javascript"> + <!-- Begin + function addChar(input, character) { + if(input.value == null || input.value == "0") + input.value = character + else + input.value += character + } + function cos(form) { + form.display.value = Math.cos(form.display.value);} + function sin(form) { + form.display.value = Math.sin(form.display.value);} + function tan(form) { + form.display.value = Math.tan(form.display.value);} + function sqrt(form) { + form.display.value = Math.sqrt(form.display.value);} + function ln(form) { + form.display.value = Math.log(form.display.value);} + function exp(form) { + form.display.value = Math.exp(form.display.value);} + function sqrt(form) { + form.display.value = Math.sqrt(form.display.value);} + function deleteChar(input) { + input.value = input.value.substring(0, input.value.length - 1) + } + function changeSign(input) { + if(input.value.substring(0, 1) == "-") + input.value = input.value.substring(1, input.value.length) + else + input.value = "-" + input.value + } + function compute(form) { + form.display.value = eval(form.display.value)} + function square(form) { + form.display.value = eval(form.display.value) * + eval(form.display.value)} + function checkNum(str) { + for (var i = 0; i < str.length; i++) { + var ch = str.substring(i, i+1) + if (ch < "0" || ch > "9") { + if (ch != "/" && ch != "*" && ch != "+" && ch != + "-" && ch != "." + && ch != "(" && ch!= ")") { + alert("invalid entry!") + return false + } + } + } + return true + } + // End --> + </script> + <div id="scientific" align="center"> + <table> + <form></form> + <tbody><tr> + <td colspan="6"><input style="width: 400px;" name="display" value="0"></td> + </tr> + <tr> + <td><input style="width: 90px;" value=" exp " onclick="if (checkNum(this.form.display.value)) { + exp(this.form) }" class="actionbutton" type="button"></td> + <td><input value="7" onclick="addChar(this.form.display, '7')" type="button"></td> + <td><input value="8" onclick="addChar(this.form.display, '8')" type="button"></td> + <td><input value="9" onclick="addChar(this.form.display, '9')" type="button"></td> + <td><input style="width: 60px;" value="/ " onclick="addChar(this.form.display, '/')" class="actionbutton" type="button"></td> + </tr> + <tr> + <td><input style="width: 90px;" value=" ln " onclick="if (checkNum(this.form.display.value)) { + ln(this.form) }" class="actionbutton" type="button"></td> + <td><input value="4" onclick="addChar(this.form.display, '4')" type="button"></td> + <td><input value="5" onclick="addChar(this.form.display, '5')" type="button"></td> + <td><input value="6" onclick="addChar(this.form.display, '6')" type="button"></td> + <td><input style="width: 60px;" value="* " onclick="addChar(this.form.display, '*')" class="actionbutton" type="button"></td> + </tr><tr> + <td><input style="width: 90px;" value=" sqrt " onclick="if (checkNum(this.form.display.value)) { + sqrt(this.form) }" class="actionbutton" type="button"></td> + <td><input value="1" onclick="addChar(this.form.display, '1')" type="button"></td> + <td><input value="2" onclick="addChar(this.form.display, '2')" type="button"></td> + <td><input value="3" onclick="addChar(this.form.display, '3')" type="button"></td> + <td><input style="width: 60px;" value="- " onclick="addChar(this.form.display, '-')" class="actionbutton" type="button"></td> + </tr><tr> + <td><input style="width: 90px;" value=" sq " onclick="if (checkNum(this.form.display.value)) { + square(this.form) }" class="actionbutton" type="button"></td> + <td><input value="0" onclick="addChar(this.form.display, '0')" type="button"></td> + <td><input style="width: 56px;" value=" . " onclick="addChar(this.form.display, '.')" class="actionbutton" type="button"></td> + <td><input style="width: 75px;" value="+/-" onclick="changeSign(this.form.display)" class="actionbutton" type="button"></td> + <td><input style="width: 60px;" value="+" onclick="addChar(this.form.display, '+')" class="actionbutton" type="button"></td> + </tr><tr> + <td><input style="width: 90px;" value=" ( " onclick="addChar(this.form.display, '(')" class="actionbutton" type="button"></td> + <td><input style="width: 75px;" value="cos" onclick="if (checkNum(this.form.display.value)) { + cos(this.form) }" class="actionbutton" type="button"></td> + <td><input value="sin" onclick="if (checkNum(this.form.display.value)) { + sin(this.form) }" class="actionbutton" type="button"></td> + <td><input style="width: 75px;" value="tan" onclick="if (checkNum(this.form.display.value)) { + tan(this.form) }" class="actionbutton" type="button"></td> + <td><input style="width: 60px;" value=" ) " onclick="addChar(this.form.display, ')')" class="actionbutton" type="button"></td> + </tr><tr> + <td><input id="deletebutton" value="Clear" onclick="this.form.display.value = 0 " type="button"></td> + <td><input value="<--" onclick="deleteChar(this.form.display)" class="actionbutton" type="button"></td> + <td><input style="width: 70px;" class="resultbutton" value="=" name="enter" onclick="if (checkNum(this.form.display.value)) { compute(this.form) }" type="button"></td> + + </tr></tbody></table> + </div> +</body> +</html>
\ No newline at end of file |
