Writing and Running Our First Program
alert("FIRST PROGRAM has started")
Note the above script can be used as a starting point for any script program. Start with this program and then add the mathematics calculations. The alert method generates a dialog box that displays text that is in the parenthesis. The quotation marks indicate that letters contained within should be displayed a text. A letter or word not in quotation marks would interpreted as a variable and its value would be displayed as a integer, floating point variable, and so forth.
Saving First Program (Phase 2)
Step 1 - Open text file blank page in your Notepad (plan text editor). Type program including the top and bottom " HTML" tags and save as a text file. Name file " FirstProgram " Note where or what folder file is being saved in, so that you can find it later. This is something you should always do when you save a file.
Step 2 - Save file again as a text file. Name file " FirstProgram.htm " . The file extension ".htm" tells browser that this file is a Web Page.
Step 3 - Close Notepad (text editor).
Step 4 - Open file First Program.htm with Internet Explorer. Message Box with words "script has started" should appear. Warning: Windows Security may block running of program. You will have to unblock program as directed by Windows.
Step 5 - Click OK button.
To run this program again click the reload button on browser upper Menu bar.
This program does not do anything but tell you that the program has started to run. I will use this script as the framework or template for future program development in this tutorial.
Writing Our Second Program
Open file text file
Add the following lines to script.
Also change title to: Simple Script 1 Phase 2
Step 7 - Then click File followed by Save. SecondProgram.htm is now modified. Source code should appear as follows:
Student Exercise: In above script, I used the multiply, divide, and add operators. Modify code by adding a formula that uses subtraction operator.
Future programs will have practical Application:
More Complex operators such as logs and exponents require the MATH object. Will include Math Object next. The object of this page was to give you a platform on which you can program. Netscape also provides a great platform for writing JAVA. I believe most of my users have Windows and Internet Explorer on their computers, and that is why I use it to teach on the Internet.