There are a few miscellaneous useful properties and methods of the Window object. The name, opener, and closed properties were already mentioned briefly earlier in this chapter. The name property specifies the name of a window or frame. In Navigator 3.0 (but not Internet Explorer 3.0), this property can be set, thereby changing the window name, which can be useful in conjunction with the TARGET attribute, for example. The opener property is created when a Navigator 3.0 (or Internet Explorer 3.0) browser window is opened--it refers to the window that most recently called the open() method for the window. closed is another Navigator 3.0 property--it specifies whether a window has already been closed. If so, then your JavaScript code should not make any further use of that window.
The focus() and blur() methods of the Window object transfer keyboard focus to, and away from, the window. If you call focus() on a browser window that is currently obscured on the desktop, it will be brought to the top and made visible. These two methods have corresponding onfocus() and onblur() event handlers that are invoked when a window gains or loses focus. Note that blur() and focus() are not supported for Window objects in Internet Explorer 3.0.
The scroll() method scrolls the contents of a window (or frame), just as if the user had used the window's scrollbars explicitly. The two arguments to this method are the absolute X and Y pixel coordinates that the document should be scrolled to. The document in the window moves so that these coordinates are in the upper-left corner of the window. For example, you can more to the top of a document with:
self.scroll(0,0);
self.scroll(0,100);
Finally, the Window object has a number of other properties, such as document, location and history, and we've seen some of these used in examples in this chapter. These properties, and others like them, simply refer to other HTML objects. These objects, and their methods and properties, are documented in the chapters that follow.
file: /Techref/language/java/script/definitive/ch12_05.htm, 6KB, , updated: 2019/10/14 15:00, local time: 2024/11/30 01:00,
3.145.62.36:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://sxlist.com/Techref/language/java/script/definitive/ch12_05.htm"> [Chapter 12] 12.5 Other Window Programming Techniques</A> |
Did you find what you needed? |
Welcome to sxlist.com!sales, advertizing, & kind contributors just like you! Please don't rip/copy (here's why Copies of the site on CD are available at minimal cost. |
Welcome to sxlist.com! |
.