Skip to content

Commit

Permalink
add exp function
Browse files Browse the repository at this point in the history
  • Loading branch information
sasbcl committed Sep 5, 2012
1 parent d003b91 commit 482365d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion calc.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@

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

var plus,minus,divide,multiply,max
var plus,minus,divide,multiply,max,pow

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]
max=document.calc.operator.options[4]
pow=document.calc.operator.options[5]
}

function calculate(){
Expand All @@ -27,6 +28,8 @@
document.calc.answer.value = a * b
if (max.selected)
document.calc.answer.value = Math.max(a,b)
if (pow.selected)
document.calc.answer.value = Math.pow(a,b)
}

</script>
Expand All @@ -48,6 +51,7 @@ <h2>Calc</h2>
<option value=divide>/
<option value=multiply>*
<option value=max>max
<option value=pow>**
</select>

<input type=text name=val2 size=10>
Expand Down

0 comments on commit 482365d

Please sign in to comment.