HTML and CSS Reference
Apply Your Knowledge continued
4. Assign this text string to a variable named Msg.
5. Use the variable name startAt as the position locator for the message.
6. In the setTimeout() method used to call the scrollingMsg() function, use 300 milliseconds as the
7. Declare a new user-defined function named emailValidate(emailForm).
8. Use an if statement to verify that the parent or guardian name text field (parent) is not blank by
testing if the length of the text field is less than 1. If the field is blank, use an alert to notify the user
with the message, “Please enter a parent or family name.”
9. Use an if statement to verify that cell phone text field is not blank by testing if the length of the
text field is less than 1. If the field is blank, use an alert to notify the user with the message, “Please
enter a cell phone number in the format of xxx-xxx-xxxx to receive text messages.”
10. Use the indexOf() method to determine if an @ sign is in the e-mail text field. Assign the result of
the indexOf() method to a variable named atSign.
11. Enter an if statement to test the value of atSign. If atSign is less than 0, then use an alert() method to
display the message, “Sorry, that e-mail address is not in the form of userID@ followed by provider
name. Please re-enter your e-mail address.”
12. Enter the else statement so that, if the e-mail address is in proper form, an alert() method will display
the message, “Thank you. Your e-mail address will be added to our mailing list.” Be sure to close the
13. Enter the proper event handler in the <body> tag to call the scrolling message function.
14. Enter the proper event handler in the <input> tag for the Submit button to call the emailValidate()
user-defined function in the <head> section.
15. Save the revised file in the Chapter10\Apply folder using the filename apply10-1solution.html.
16. Validate using the w3.org validation Web page.
17. Test the Web page in your browser.
18. If any errors occur, check the code against Steps 1 through 14, make any required changes, save the
file using the same filename, and then refresh the Web page in the browser.
19. Submit the revised HTML file and Web page in the format specified by your instructor.
Extend Your Knowledge
Extend the skills you learned in this chapter and experiment with new skills. You will need to
search the Internet to complete the assignment.
Learning More About Displaying Messages
Instructions: Start Notepad++ and your browser. Open the file extend10-1.html from the Chapter10\
Extend folder of the Data Files for Students. See the inside back cover of this topic for instructions on
downloading the Data Files for Students, or contact your instructor for information about accessing the
The extend10-1.html file is a partially completed HTML file that you will use for this exercise.
Figure 10-42 shows the Extend Your Knowledge Web page as it should be displayed in a browser after
A number of Web sites use forms where part of the form or a button is “disabled” by being
grayed out or not visible until a response to a question or an option button or check box item has been
selected. Once the question, option button, or check box has been filled or selected a button, text field,
or image may become visible or usable.