javascript手冊-u-z[5]

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 longj 的 blog

windowname is the window name to use in the target attribute of a <form> or <a> tag.

for details on defining a window, see the open method.

to use a window object's properties and methods:

 1. window.propertyname
 2. window.methodname(parameters)
 3. self.propertyname
 4. self.methodname(parameters)
 5. top.propertyname
 6. top.methodname(parameters)
 7. parent.propertyname
 8. parent.methodname(parameters)
 9. windowvar.propertyname
10. windowvar.methodname(parameters)
11. propertyname
12. methodname(parameters)
windowvar is a variable referring to a window object. see the preceding 语法 for defining a window.
propertyname is one of the properties listed below.
methodname is one of the methods listed below.

to define an onload or onunload event handler for a window object, use the <body> or <frameset> tags:

<body
   ...
   [onload="handlertext"]
   [onunload="handlertext"]>
</body>

<frameset
   rows="rowheightlist"
   cols="columnwidthlist"
   [onload="handlertext"]
   [onunload="handlertext"]>
   [<frame src="locationorurl" name="framename">]
</frameset>

for information on the <body> and <frameset> tags, see the document and frame objects.

property of

  • none.

    描述

    the window object is the top-level object in the javascript client hierarchy. frame objects are also windows.

    the self and window properties are synonyms for the current window, and you can optionally use them to refer to the current window. for example, you can close the current window by calling either window.close() or self.close(). you can use these properties to make your code more readable, or to disambiguate the property reference self.status from a form called status. see the properties and methods listed below for more 例子.

    the top and parent properties are also synonyms that can be used in place of the window name. top refers to the top-most navigator window, and parent refers to a window containing a frameset. see the top and parent properties.

    because the existence of the current window is assumed, you do not have to reference the name of the window when you call its methods and assign its properties. for example, status="jump to a new location" is a valid property assignment, and close() is a valid method call. however, when you open or close a window within an event handler, you must specify window.open() or window.close() instead of simply using open() or close(). due to the scoping of static objects in javascript, a call to close() without specifying an object name is equivalent to document.close().

    you can reference a window's frame objects in your code by using the frames array. the frames array contains an entry for each frame in a window with a <frameset> tag.

    windows lack event handlers until some htm is loaded into them containing a <body> or <frameset> tag.

    properties

  • defaultstatus reflects the default message displayed in the window's status bar
  • frames is an array reflecting all the frames in a window
  • length reflects the number of frames in a parent window
  • 本文关键:javascript
     

    本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

    go top