CSE 3 Fluency in Information Technology, UCSD, Winter 2004
Laboratory 8: To be done in your lab section in
the week of February 23
In this lab you will practice using JavaScript functions that return a value and practice some of the previous things you learned about displaying images.
You will be provided with the file functionDemo.html. When displayed it shows three text fields and has a button. If you type three numbers in the text fields and click the button, then an alert window pops up and gives you the average of the three numbers. Study this file and be sure you understand it. Note that there are two functions, one returns a value and one does not return a value. (You can and should do this studying before you get into lab.)
You will write an HTML page named functionDemo2.html that behaves as follows:
It is an enhancement of functionDemo.html.
It has a main title (your choice) and an icon (provided by the proctor), followed by
Three text fields on one line and labeled “Enter First Three Numbers” (The text can be on a separate line.)
This is followed by another three text fields on one line and labeled “Enter Second Three Numbers” (The text can be on a separate line.)
And all this is followed by a button with a suitable label.
When the button is clicked an alert window pops up and gives the average of the first three numbers.
When you click “OK” in the first alert window, a second alert window pops up and gives the average of the second three numbers.
When you click ”OK” in the second window, a third alert window pops up and says some ending message
Such as “That’s all folks”. Your proctor will tell you what this ending message should say.
Finally when you click “OK” in this last alert window, the window goes away and the displayed icon changes to a different icon. The icons will be provided by your proctor.
Your HTML page should have a title and address section, and your code should be nice and neat.
Hint: Do things in stages. For example,
First get the 6 text fields and the first two alert windows working.
Then add the third alert window.
Then add the icons and icon changes.
RULES: You must use the function average from functionDemo.html as is with no changes. You will call the function average two times, one for each set of three numbers. You must use a modified version of showResults from functionDemo,html. This modified version will have 6 parameters (6 blanks that can have arguments plug in.)