topical media & game development

talk show tell print

lib-js-math-calculator-5-function.htm / htm



  
  <!-- TWO STEPS TO INSTALL 5 FUNCTION CALCULATOR:
  
     1.  Paste the coding into the HEAD of your HTML document
     2.  Add the last code into the BODY of your HTML document  -->
  
  <!-- STEP ONE: Copy this code into the HEAD of your HTML document  -->
  
  <HEAD>
  
  <SCRIPT LANGUAGE="JavaScript">
  
  <!-- Original: Rick Johnson -->
  <!-- Web Site:  http://members.tripod.com/~RickJohnson -->
  
  <!-- This script and many more are available free online at -->
  <!-- The JavaScript Source!! http://javascript.internet.com -->
  
  <!-- Begin
  function a_plus_b(form) {
  a=eval(form.a.value)
  b=eval(form.b.value)
  c=a+b
  form.ans.value = c
  }
  function a_minus_b(form) {
  a=eval(form.a.value)
  b=eval(form.b.value)
  c=a-b
  form.ans.value=c
  }
  function a_times_b(form) {
  a=eval(form.a.value)
  b=eval(form.b.value)
  c=a*b
  form.ans.value=c
  }
  function a_div_b(form) {
  a=eval(form.a.value)
  b=eval(form.b.value)
  c=a/b
  form.ans.value = c
  }
  function a_pow_b(form) {
  a=eval(form.a.value)
  b=eval(form.b.value)
  c=Math.pow(a, b)
  form.ans.value = c
  }
  // End -->
  </SCRIPT>
  
  <!-- STEP TWO: Put this code into the BODY of your HTML document  -->
  
  <BODY>
  <CENTER>
  <FORM name="formx"><input type=text size=4 value=12 name="a"> 
  <input type="button" value="  +  " onClick="a_plus_b(this.form)">  
  <input type="button" value="  -  " onClick="a_minus_b(this.form)">  
  <input type="button" value="  x  " onClick="a_times_b(this.form)">  
  <input type="button" value="  /  " onClick="a_div_b(this.form)">  
  <input type="button" value="  ^  " onClick="a_pow_b(this.form)">  
  <input type="number" size=4 value=3 name="b"> = <input type "number" value=0 name="ans" size=9>
  </FORM>
  </CENTER>
  
  <p><center>
  <font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
  by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
  </center><p>
  
  <!-- Script Size:  1.72 KB  -->
  a
  <!-- TWO STEPS TO INSTALL 5 FUNCTION CALCULATOR:
  
     1.  Paste the coding into the HEAD of your HTML document
     2.  Add the last code into the BODY of your HTML document  -->
  
  <!-- STEP ONE: Copy this code into the HEAD of your HTML document  -->
  
  <HEAD>
  
  <SCRIPT LANGUAGE="JavaScript">
  
  <!-- Original: Rick Johnson -->
  <!-- Web Site:  http://members.tripod.com/~RickJohnson -->
  
  <!-- This script and many more are available free online at -->
  <!-- The JavaScript Source!! http://javascript.internet.com -->
  
  <!-- Begin
  function a_plus_b(form) {
  a=eval(form.a.value)
  b=eval(form.b.value)
  c=a+b
  form.ans.value = c
  }
  function a_minus_b(form) {
  a=eval(form.a.value)
  b=eval(form.b.value)
  c=a-b
  form.ans.value=c
  }
  function a_times_b(form) {
  a=eval(form.a.value)
  b=eval(form.b.value)
  c=a*b
  form.ans.value=c
  }
  function a_div_b(form) {
  a=eval(form.a.value)
  b=eval(form.b.value)
  c=a/b
  form.ans.value = c
  }
  function a_pow_b(form) {
  a=eval(form.a.value)
  b=eval(form.b.value)
  c=Math.pow(a, b)
  form.ans.value = c
  }
  // End -->
  </SCRIPT>
  
  <!-- STEP TWO: Put this code into the BODY of your HTML document  -->
  
  <BODY>
  <CENTER>
  <FORM name="formx"><input type=text size=4 value=12 name="a"> 
  <input type="button" value="  +  " onClick="a_plus_b(this.form)">  
  <input type="button" value="  -  " onClick="a_minus_b(this.form)">  
  <input type="button" value="  x  " onClick="a_times_b(this.form)">  
  <input type="button" value="  /  " onClick="a_div_b(this.form)">  
  <input type="button" value="  ^  " onClick="a_pow_b(this.form)">  
  <input type="number" size=4 value=3 name="b"> = <input type "number" value=0 name="ans" size=9>
  </FORM>
  </CENTER>
  
  <p><center>
  <font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
  by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
  </center><p>
  
  <!-- Script Size:  1.72 KB  -->
  
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.