Sams Teach Yourself JavaScript in 24 Hours, 3rd Edition

Sams Teach Yourself JavaScript in 24 Hours

By

Quiz

Test your knowledge of JavaScript windows and frames by answering the following questions.

Questions

1:

Which of the following methods displays a dialog box with OK and Cancel buttons, and waits for a response?

  1. window.alert
  2. window.confirm
  3. window.prompt
A1:

b. The window.confirm method displays a dialog box with OK and Cancel buttons.

2:

What does the window.setTimeout method do?

  1. Executes a JavaScript statement after a delay.
  2. Locks up the browser for the specified amount of time.
  3. Sets the amount of time before the browser exits automatically.
A2:

a. The window.setTimeout method executes a JavaScript statement after a delay.

3:

You're working with a document that contains three frames with the names first, second, and third. If a script in the second frame needs to refer to the first frame, what is the correct syntax?

  1. window.first
  2. parent.first
  3. frames.first
A3:

b. The script in the second frame would use parent.first to refer to the first frame.

Share ThisShare This