NAME Attribute | name Property

DHTML, HTML, & CSS

NAME Attribute | name Property


Sets or retrieves the window or frame name.

Syntax

HTML<ELEMENT NAME = sName ... >
Scriptingobject.name [ = sName ]

Possible Values

sName String that specifies one of the following values:
_blankLink is loaded into a new, unnamed window.
_parentLink is loaded over the parent. If the frame has no parent, this value refers to _self.
_selfPage is replaced with the specified link.
_topLink is loaded at the topmost level.
nameArbitrary name used to identify the object.

The property is read/write with no default value.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see dynamic propertiesInternet Link.

Remarks

The name property identifies which frame displays the content of a linked document.

To access a window's name property, use the window keyword.

Example

This example assigns the name property to the window object.

Sample Code

window.name="MyWindow";

This example uses scripting to set the name property of a frame.

Sample Code

parent.frames[0].name="Left";

This example shows how the NAME attribute for a window can be persisted in HTML, but only when defined in a frame within a frameset.

Sample Code

<FRAMESET>
    <FRAME NAME="Left" SRC="blank.htm">
    <FRAME NAME="Right" SRC="contents.htm">
</FRAMESET>

This example uses the window's open method to assign the name property.

Sample Code

window.open("file.htm","Frame1");

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
Version data is listed when the mouse hovers over a link, or the link has focus.
FRAME, IFRAME, window

Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.