To run this program

To run this program

To run this program, open Calculator.html in browser. If browser gives active x warnng, allow it to run javascript or the program will not work. 

Enter the values in text boxes and click buttons to perform desired operation on the values.

There will be errors show to the next of text boxes if entered values are not valid.

Upon completing this module, the student should be able to:

Understand and Use Event Handlers

Understand and Use Objects

Understand and Use Forms

Answer all questions at the end of Chapters 7, 8, and 14 of the book.

Now that we know about variables and functions and how to control what we want to output, It’s time to learn how to get input from a user.

Browsers do that by presenting a form the users use to input data and to click a button or link to tell the browser they are done.

Chapter 14 of the book tells you how to do that.  Before you’ll understand chapter 14, you definitely must understand chapters one through eight.  You should at least read through chapters nine through 13, but they are not specifically required for this course.

So, make sure you fully understand chapter 14 before going to the next slide!

Your assignment must be uploaded to your instructor via your Student Portal.  Emailed assignments are NOT accepted for this course!

You can only upload one file per assignment.  Since this assignment requires multiple files, you must create a .zip file.

If you are using a recent version of Microsoft windows, you can create the ZIP file (compressed folder) by creating a new folder anywhere in your computer’s file system and putting the files in that folder. Then right-click on the folder and select “Send to” and then “compressed (zipped) folder”. Alternatively, you can use a program such as WinZIP (

It doesn’t matter what you name the file you upload except that the file extension must be .zip.
Once uploaded you cannot upload the assignment again unless reset by your instructor – please take the time to do it right the first time!

Each file in the assignment must have a comment at the top, using the correct commenting technique for the file type, like this:
            Your Name
            Your Student ID
            Assignment 4

Create a very simple four function integer calculator with buttons for Add, Subtract, Multiply, and Divide, and with two text-type input fields.  When the user enters two numbers and clicks one of the buttons, the answer is displayed where shown. 

Your program must use an alert to tell the user about any errors.  The possible errors include:
One or both input fields are blank
One or both input fields < -9999 or greater than 9999

Divide by zero

Illegal character in either input field.
 Only 0, 1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9, and – are allowed.

You must include instructions to the instructor on how to install the assignment.  Do this in a separate file named ReadMe.txt. 

Even though there are none in the example, you must include instructions to the user.
Powered by