Calculator

Set parameters and press Update!
Parameter Value
calcwidth=
calcheight=
calcborderwidth=
calcspacing=
calcdispwidth=
calcdispheight=
calcdispfont=
calcdispmargin=
calcbuttonwidth=
calcbuttonheight=
calcbuttonfont=
calcbuttonmargin=
   
   
>>> <<<

This example is written in pure JavaScript and held entirely in a separate file. You only have to include it in your page. The actual appearance of the calculator may vary from browser to browser. It was tested with Microsoft Internet Explorer 5.5 and Netscape Navigator 6.

To use it on your own page:

  1. After registration save the calculator.js file in the same directory where your page is.
  2. Insert the <script src="calculator.js"></script> string into the head of your page
  3. You may want to change the parameters of the calculator. Insert and edit the following definition block before calling the calculator:
    <script>
    // Parameters of the calculator:
      calcwidth=220; calcheight=240; calcborderwidth=2; calcspacing=2;
    // Parameters of the display area:
      calcdispwidth=210; calcdispheight=50;
      calcdispfont="bold 24pt 'Courier New', Courier, mono";
      calcdispmargin=5;

    // Parameters of the buttons:
      calcbuttonwidth=35; calcbuttonheight=35;
      calcbuttonfont="bold 14pt Arial, Helvetica, sans-serif";
      calcbuttonmargin=5;

    </script>
  4. Insert the <script>calcwr()</script> string where you want to see the calculator.

See also the Java Calculator. It is similar to this one, but has more functions and better error correction.

Back to home  More JavaScript  Top of the page  Request more information