CIS 223 Lab Assignment #8
In this lab, you will create your JavaScript page, which will
include your name into the JavaScript
comment. You will also create a function to prompt for two numbers
and call another function to
calculate the total of the two numbers. The onload event handler is
also being used in this lab
assignment.
1. Create an HTML document in your text editor (Microsoft NotePad
for Windows or TextEdit for
Mac) and type the <!DOCTYPE> declaration, <html>
element, document head, and <body>
element. Use the “CIS 223 Lab Assignment #8” as the content of the
<title> element (see example
2.11 for guidance).
2. The first component of your assignment this week is to create an
HTML document that is
displaying a running clock (with the current time) as the HTML page
is being displayed (no
button is needed to trigger the display).
3. Next create a HTML form that asks the user to enter 3 different
grocery items. You can create 3
textboxes and one button as shown in the previous picture.
4. After the user enters three items, and click the button. Your
program should prompt the user to
enter more items (Enter 0 to finish)
5. Write the program so that the 3 items in the textboxes are added
into a JavaScript array. (therefore,
upon submitting the form, call your JS function. Prompt the user AS
MANY TIMES AS THE
USER enters something, to add more items into the array (consider a
WHILE loop). Each time the
user enters a new item, add it to the array. When the user is
done, likely they will enter 0 at your
prompt to let you know.
6. Display to an alert window all items that are a part of the
array (including the 3 items from the
form and however many items that were added in from each of the
prompts), in ascending
alphabetical order, each item on its own line and displaying like
it is an “ordered list” (since this is
an alert, you cannot use UL/LI). This will likely be best done with
a FOR loop).
7. When the user clicks the OK button, display to a popup the total
number of letters that compose
your Array with text prefixing “Total letters: ##”. In the same
window, new line, state “Total
Elements: ##” Which will display the number of entries into your
array.
8. If your web page does not show the correct results. You should
use the editor to make the
necessary changes and test your web page again.
9. Submit your homework (YourLastName_Lab8.html document) in
iCampus