JavaScript

Saturday April 5, 2025
updated: April 10, 2002

 
Home
Getting Started
Lesson 1
Lesson 2
Lesson 3
Lesson 4
Lesson 5
Lesson 6
Lesson 7
Lesson 8
Resources
Credits

 

 


Assignment 5

Create a JavaScript that will do the following:

In assignment 3 you used a form to get the users name so it could be written to a document. In this assignment you will use a form to get the user to input 2 numbers then upon the user clicking on the total button, the sum is displayed in the bottom form. Use the layout below as a guide:

ADDING TWO NUMBERS WITH JAVASCRIPT

 

First number to be added:
Second number to be added:
Click total for sum :

 

In order to do this assignment you will have to call the function when the user clicks on the total button. The function itself will first declare the variables, calculate the total, then write the total to the screen.

HINT: document.form1.total.value=a*1+b*1 (will add variable a and b together and display the sum in form1 of the document which was named total)

Save as: A5YourName.html


© 2002 Tracy Johnson