alert() method of the
window object. When the browser reads that line of code, it will pop up an alert box and will not continue processing the page until the user presses the
OK button. Once the user presses the button, the alert box disappears and the rest of the page loads.
write() method of the
Methods can take zero or more arguments separated by commas.
write() methods shown in the example above each take only one argument: the message to show or the HTML to write out to the browser.
span elements use the
onclick event handler to catch click events. When the user clicks on a
The Implicit window Object
window object is always the implicit top-level object and therefore does not have to be included in references to objects. For example,
window.document.write() can be shortened to
window.alert() can be shortened to just