<HTML> <HEAD> <Title>Sample Program Ten</title> </HEAD> <BODY TEXT="#000000" link="000000" VLINK="#000000" BACKGROUND="background.jpg"> <FONT FACE="ARIAL"> <CENTER><TABLE WIDTH="79%"> <TR> <TD> <CENTER><H2><FONT FACE="Beehive"><FONT COLOR="#C100C1"><FONT SIZE=+4> A Sample Calculator</FONT></FONT></FONT></H2></CENTER> </TD> </TR> </TABLE></CENTER> <h3><p> <SCRIPT LANGUAGE = "JavaScript"> //Function to do simple calculations //Arguments: // theForm - the form in which a text field // that contains the input resides //Return value: // the answer, written in the text area // that resides in theForm function simpleCalculator(theForm) { if ( confirm("Do the computation now?") ) { theForm.answer.value = eval(theForm.expression.value) } else { alert("No calculation done.") } } </SCRIPT> </HEAD> <BODY> <H3> Simple Calculator </H3> <FORM> <B>Expression:<BR> <INPUT TYPE = "text" NAME = "expression" SIZE = 15> <INPUT TYPE = "button" VALUE = 'Calculate' onClick = "simpleCalculator(this.form)"><BR> Result:<BR> <INPUT TYPE = "text" NAME = "answer" SIZE = 15> <BR> </form> <P><hr><p> <h6><i>Page Owner:</i> <a href="http://www.umsl.edu/~sauter/">Professor Sauter</a> (<a href="mailto:Vicki.Sauter@umsl.edu">Vicki.Sauter@umsl.edu</a>)<br> <SCRIPT LANGUAGE = "JavaScript"> // This automatically updates the last modified date for the page. // when = document.lastModified document.write("<i>This page was last modified on:</i> " + when + "<br>") // // This automatically updates the location documentation on the page. where = document.location document.write("<i>URL:</i> " + where) </script> <br> © Vicki L. Sauter. All rights Reserved.