Lesson #5 Review Questions

Back to Lesson # 5 - Event Handlers Table of Contents # 5 Assignment

 

 

1. According to the Netscape Document Object Model, which object is at the top of the hierarchy in a browser window?

document
form[0]
frame
window
2. Objects such as forms and images are contained in what parent or container object?

document
window
frame
form[0]
3. The Hot Rod Racing Club has asked you to create their user login web screen, so you have a text box named userName that sits on a form named userLogin. We want to pre-initialize the value in that box to "new member type Guest". You would use:

window.userLogin.UserName.value = "new member type Guest"
document.userLogin.userName.value="new member type Guest"
document.userName.userLogin.value = "new member type Guest"
userName="new member type Guest"
4. One of the events for a window object is called Focus, meaning that the window is selected by the user. The event handler for that event would be called:

Focus
Focus()
onFocus
on.window.Focus
5. Often, web sites have a sponsor's ad pop open just as you try to exit their site by closing the browser window. What is the event handler that causes the ad to pop up?

onBlur
onExit
onMouseOut
onUnload
6. To create a visual effect called a rollover, we set an image to one source file as the document loads. Then when the user rolls their mouse over that image, the onMouseOver event calls up a difference source image from a different file. To make the original image re-appear when the user moves the mouse off of the image, we would use which event handler?

onExit
onMouseOut
onUnload
onMouseDown

7. Which of the following is the correct explanation of why there are single quotes around the message?

onError = "alert('Our Web Site is having a bad day. Please call 1-800-999-9999 for service.');"

Messages containing telephone numbers must use single quotes in JavaScript.
It actually would not matter, JavaScript would take it either way.
JavaScript needs a way to tell the difference between the string for the onError event handler and the string for the alert() method's argument.
All statements in JavaScript 1.2 will use the single quotes..
8. You have created a web page for your school's fund raising project, and when a user clicks a certain checkbox, you wish to have a "Thank You" message pop up. Finish the code for the event handler: <INPUT TYPE="checkbox" NAME="chkSendMoney" onClick=

"Thank You for Your Support!"
alert( " Thank You for Your Support! " )
"alert(Thank You for Your Support! );"
"alert( ' Thank You for Your Support!' );"
9. If your web page loads an image from another url there are lots of potential errors (such as maybe the other server is off line!, or a connection is down, etc ) so you may want to display a polite "Oops" message if the image fails to load. Which is the correct way to code the event handler?

<IMG SRC="http://www.somewhereElse.com/picturefile.jpg" onError='Oops, sorry!'>
<IMG SRC="http://www.somewhereElse.com/picturefile.jpg" Error="alert('Oops, sorry!');")>
<IMG SRC="http://www.somewhereElse.com/picturefile.jpg" onLoad="alert('Oops, sorry!');")>
<IMG SRC="http://www.somewhereElse.com/picturefile.jpg" onError="alert('Oops, sorry!');")>
10. For a special holiday promtion, you wish to display a special message when a user first opens the Rock Candy Village web site. What event handler will do the job?

<BODY BGCOLOR="red" onError = "alert('Check the link for Christmas Specials');">
<BODY BGCOLOR="red" onLoad = "alert('Check the link for Christmas Specials');">
<BODY BGCOLOR="red" onStartup = "alert('Check the link for Christmas Specials');">
<BODY BGCOLOR="red" onLoad = ('Check the link for Christmas Specials')>

Return to Top of Page | Back to Main Menu