April 17, 2000 - The name Property
![]() |
April 17, 2000 The name Property Tips: April 2000
Yehuda Shiran, Ph.D.
|
name property (IE3+, N2+). We can also set the name property of a frame or window (IE3+, N3+). Let's take a look at the following HTML document (showname.html):
<HTML>
<HEAD><TITLE>Display Name</TITLE></HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!--
alert('The name of this window is: "' + window.name + '"');
// -->
</SCRIPT>
</BODY>
</HTML>Take a look at the following links:
<A HREF="showname.html" TARGET="_blank">A New Window</A>
<A HREF="showname.html" TARGET="first">First Window</A>
<A HREF="showname.html" TARGET="second">Second Window</A>
<A HREF="showname.html" TARGET="third">Third Window</A>The document showname.html consists of a script that displays the name of the window in an alert dialog box. Go ahead and test these links:
A New Window
First Window
Second Window
Third Window
The name property belongs to the window object. It can be used with any window object, including a frame. For example, the following statement sets the name of a frame window:
parent.frames[1].name = "right";When working with frames, it's easy to access various levels of the window hierarchy. For more details, refer to Window References (November 7, 1999).
Learn more about windows creation and usage in Tutorial 1, Working with Windows.



