name property (window)
Sets or retrieves the name of the current window object, which is used to identify the window.
With the name property, the name of a window can be modified, after the window has been created.
It is also possible to specify the initial name of a newly created window.
- When a window is opened by an anchor, then the target property specifies the initial name of the created window. For details, see Example 1 or the page for the target property.
- When a window belongs to a frame or iframe element, then the name property sets the initial name of the contained window. See Example 2 for details.
- Finally, if a window is created dynamically by the open method, then the second parameter of the method specifies the initial name of the created window. See Example 3 for details.
Syntax:
You can find the related objects in the Supported by objects section below.
This property is read/write.
Possible values:
String that specifies or retrieves the name of the window.
Default: this property has no default value.
Example HTML code 1:
This example shows how to create named windows with anchor elements:
|
|||||
<a href="nameTest.htm" target="myWindow">Open a new window, with the name of myWindow!</a> |
|||||
|
|||||
Did you find this example helpful?
|
Example HTML code 2:
This example illustrates named windows inside iframe objects:
|
|||||
<iframe name="TargetFrame" src="nameTest.htm" height="150" width="200"></iframe> |
|||||
|
|||||
Did you find this example helpful?
|
Example HTML code 3:
This example illustrates the use of the open method for creating named windows:
|
|||||
<head> <script type="text/javascript"> function OpenChildWindow () { var childWindow = window.open ("nameTest.htm", "myWindow", "width=200,height=200", null); } </script> </head> <body> <button onclick="OpenChildWindow ()">Open child window with name of myWindow!</button><br /> </body> |
|||||
|
|||||
Did you find this example helpful?
|
Supported by objects:
Related pages:
External links:
User Contributed Comments