Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions calc.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
<html>
<head>
<title>Calc</title>

<script language=javascript type="text/javascript">

var plus,minus,divide,multiply

function initialize(){
plus=document.calc.operator.options[0]
minus=document.calc.operator.options[1]
divide=document.calc.operator.options[2]
multiply=document.calc.operator.options[3]
}

function calculate(){
a = parseInt(document.calc.val1.value)
b = parseInt(document.calc.val2.value)
Expand All @@ -25,35 +21,24 @@
if (multiply.selected)
document.calc.answer.value = a * b
}

</script>

</head>

<body onLoad="initialize()">
<h2>Calc</h2>

Enter a number in the first box and a number in the second box and select the answer button to see the answer.
<br>
Change the operation via the dropdown selection box if desired.
<form name="calc" action="post">
<input type=text name=val1 size=10>

<select name=operator>
<option value=plus>+
<option value=minus>-
<option value=divide>/
<option value=multiply>*
</select>

<input type=text name=val2 size=10>
=
<input type=text name=answer size=10>
<input type=text name=val2 size=10> = <input type=text name=answer size=10>
<input type=button value=answer onClick="calculate()">
</form>

<br><br>


</body>
</html>
</html>