Calculator Format

Home Up 
This Page Format is Obsolete!  Go to new site :

This Site will go away in spring of 2016:  Please visit to see NEW SITE!


series 2 pure


Calculator Format

You may have noticed that the calculators you have have seen on the Internet to not rely on a sequence of popup menus to input data or see results.  The calculators appear on the Web page on a form complete with buttons and text boxes to type in data and display results.  The form below complete with text boxes and buttons is not generated with JavaScript, but are produced as part of the HTML Page.  The calculator below performs evaluates the equation Y = XN .  



Simple computer Graphical User Interface (GUI)


Program for above calculator below.  Copy it and run it on your computer using methods taught on previous page.


<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<SCRIPT LANGUAGE = "JavaScript">
var inputtext = "hello"
var X = 10.0
var N = 3 
var Y = 2 // global

var recipRt= 1 // global
var clr = "" // global
var Alpha = "H" // global 

function datainput(){X = prompt ("Enter decimal number for X " , "");N = prompt ("Enter Integer for N " , ""); alert("data entry complete"); }

function mathgeneral(){
Y = Math.pow(X, N)

alert("Y = "+ Y); Alpha = ("Y = "+ Y)}


<p align="center">Simple computer Graphical User Interface (GUI)</p>

<form name="B1">

<textarea rows="6" name="S1" cols="50"></textarea>
<p><input type="button" value="Input" name="B1"onclick = "datainput() "> 
<input type="button" value="Execute" name="B2"onclick = "mathgeneral()">
<input type="button" value="Output" name="B3"onclick = "document.B1.S1.value = Alpha">


Note that I still use popup menus to input data.  If I provided an input textbox for each input, the HTML code would become far more complex.  Complex HTML code can easily be generated with a development system such as FrontPage.  You can use above code as a template for any scientific calculation you would like to make.  Note that the calculations had to be performed in a function that I attached to a button using the onclick statement.  If this appears to be getting too complicated, you should remember that you can simply stick with inputting data using popups.  Popups work fine for calculations that you do not intend to publish on the Internet.


Questions or problems regarding this web site should be directed to

Copyright ©2003 Science Ebooks All rights reserved.
Last modified: Monday January 18, 2016.