HTML and CSS Reference
In-Depth Information
<h3>Click here to see through my winter window<br />
<a href="JavaScript:newWindow()">Winter Scene</a></h3>
The JavaScript function newWindow is defined.
The open method is called and returns a window object that is assigned to the vari-
able, winObj . The first argument to the open method is the URL of the new win-
dow; in this case the document is an image file called winter.jpg located in the cur-
rent directory. The name to be associated with this window is winter .
When the user clicks on the line Winter Scene , the JavaScript user-defined func-
tion, newWindow , is called (see Figure 10.16). This function is responsible for
opening the new window. Instead of a URL, the HTML < a href > tag is assigned
name of a JavaScript function. The JavaScript: label allows the function to be
called when the user clicks the link. Without the JavaScript: label, the browser will
try to find a URL address called newWindow() and fail.
Figure 10.16 A new popup window showing a winter scene is opened.
Search WWH ::

Custom Search