-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
162 lines (93 loc) · 6.15 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xlmns="http://w3.org/1999/xhtml">
<head>
<!-- Favicon -->
<link rel="icon" type="image/vnd.microsoft.icon" href="calc.ico">
<title>Ben's Javascript Complex Scientific Calculator</title>
</head>
<body style="background-color: beige;">
<h1 align="center"><font face="arial, helevica"><strong><u>Ben's
JavaScript Complex Scientific Calculator</u></strong></font></h1>
<!-- JS code moved to separate file -->
<script language="javaScript" type="text/javaScript" src="complex.js">
<!-- This is a JavaScript complex scientific calculator that performs several calculations including basic math (adding, subtracting, square roots, percents, rounding), algebraic functions (exponents, logarithms), and trigonometric functions (sine, cosine, and tangent). All trigonometric results are displayed only in radians, NOT degrees by default. -->
<!-- To create this complex calculator, I used JavaScript Math object functions, such as Math.sin, Math.round, etc. For the layout of this calculator, I had created a table (with invisible borders) using HTML. -->
</script>
<br />
<br />
<br />
<form method="post" name="cmplxcalc" id="cmplxcalc">
<table style="height: 200px; width: 500px;" align="center" bgcolor="gray" border="0" cellpadding="3" cellspacing="3">
<tbody>
<tr>
<td colspan="4" align="center"><input name="txtbox_area" id="txtbox_area" maxlength="20" size="45" value="0" type="text"></td>
<td align="center"><input name="btclear" value=" C /CE " onClick="Clear()" type="button"></td>
<td align="center"><input name="equals" value=" = " onClick="Answer()" type="button"></td>
<td align="center"> </td>
<td align="center"><font face="arial, helevica" size="+1">TI - 39Xa</font></td>
</tr>
<tr>
<td align="center"><input name="Seven" value=" 7 " onClick="AddAChar('7')" type="button"></td>
<td align="center"><input name="Eight" value=" 8 " onClick="AddAChar('8')" type="button"></td>
<td align="center"><input name="Nine" value=" 9 " onClick="AddAChar('9')" type="button"></td>
<td align="center"><input name="btplus" value=" + " onClick="AddAChar('+')" type="button"></td>
<td align="center"><input name="btsub" value=" - " onClick="AddAChar('-')" type="button"></td>
<td align="center"><input name="btsin" value=" sin " onClick="sin()" type="button"></td>
<td align="center"><input name="btcos" value=" cos " onClick="cos()" type="button"></td>
<td align="center"><input name="bttan" value=" tan " onClick="tan()" type="button"></td>
</tr>
<tr>
<td align="center"><input name="Four" value=" 4 " onClick="AddAChar('4')" type="button"></td>
<td align="center"><input name="Five" value=" 5 " onClick="AddAChar('5')" type="button"></td>
<td align="center"><input name="Six" value=" 6 " onClick="AddAChar('6')" type="button"></td>
<td align="center"><input name="btmult" value=" x " onClick="AddAChar('*')" type="button"></td>
<td align="center"><input name="btdiv" value=" / " onClick="AddAChar('/')" type="button"></td>
<td align="center"><input name="btasin" value=" asin " onClick="asin()" type="button"></td>
<td align="center"><input name="btacos" value=" acos " onClick="acos()" type="button"></td>
<td align="center"><input name="btatan" value=" atan " onClick="atan()" type="button"></td>
</tr>
<tr>
<td align="center"><input name="One" value=" 1 " onClick="AddAChar('1')" type="button"></td>
<td align="center"><input name="Two" value=" 2 " onClick="AddAChar('2')" type="button"></td>
<td align="center"><input name="Three" value=" 3 " onClick="AddAChar('3')" type="button"></td>
<td align="center"><input name="Percent" value=" % " onClick="percent()" type="button"></td>
<td align="center"><input name="Sqrt" value=" sqrt " onClick="sqrt()" type="button"></td>
<td align="center"><input name="Pi" value=" Pi " onClick="pi()" type="button"></td>
<td align="center"><input name="cubbut" value=" x^2 " onClick="square()" type="button"></td>
<td align="center"><input name="e" value=" e^1 " onClick="Euler()" type="button"></td>
</tr>
<tr>
<td align="center"><input name="Zero" value=" 0 " onClick="AddAChar('0')" type="button"></td>
<td align="center"><input name="TwoZeroes" value=" 00 " onClick="AddAChar('00')" type="button"></td>
<td align="center"><input name="dot" value=" . " onClick="AddAChar('.')" type="button"></td>
<td align="center"><input name="neg" value=" +/- " onClick="negative()" type="button"></td>
<td align="center"><input name="rounding" value=" round " onClick="Round()" type="button"></td>
<td align="center"><input name="btrdm" value=" Rdm " onClick="rand()" type="button"></td>
<td align="center"><input name="btlog" value=" log " onClick="Log()" type="button"></td>
<td align="center"><input name="btln" value=" ln " onClick="natLog()" type="button"></td>
</tr>
</tbody>
</table>
</form>
<br />
<br />
<h2 align="center"> Function Key: </h2>
<br />
<ul>
<li><strong>Sin:</strong> The Sine of x</li>
<li><strong>Cos:</strong> The Cosine of x</li>
<li><strong>Tan:</strong> The Tangent of x</li>
<li><strong>Asin:</strong> The ArcSine (inverse sine of x)</li>
<li><strong>Acos:</strong> The ArcCosine (inverse cosine of x)</li>
<li><strong>Atan:</strong> The ArcTangent (inverse tangent of x)</li>
<li><strong>Sqrt:</strong> Square Root</li>
<li><strong>Pi:</strong> Pi constant: 3.14159...</li>
<li><strong>x^2:</strong>The square of any number</li>
<li><strong>e^1:</strong> Euler's constant (e): 2.71828...</li>
<li><strong>Round:</strong>Rounds decimal numbers</li>
<li><strong>Rdm:</strong> Provides random numbers between 0 and 1</li>
<li><strong>Log:</strong> Returns the logarithm (in decimals) of the number</li>
<li><strong>Ln:</strong> Natural logarithm</li>
</ul>
</body>
</html>