self (Property)

An alias for the window.self property.


JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape - 2.0
Opera - 3.0
Property/method value type:Window object
JavaScript syntax:-myWindow.self

This property yields a reference to the current window in which a script is running. This means that the statement self.close() is effectively window.close().

This is another name for the window.window property in this context. However, self is useful because you can build reusable scripts with it that can be used with a variety of object types and instances. Don't forget that this can also refer to a Frame as well as a Window since they are both represented by the Window object.

The self property can be used without the window prefix because it belongs to the global object in a web browser window. Using the self keyword makes no difference to the functionality of a script but it makes it easier to understand. For the same reason, you may want to use the window property in the same way.

See also:Frame object, UniversalBrowserAccess, UniversalBrowserWrite, Window object, Window.frame, Window.self

Property attributes: