please dont rip this site

JavaScript: The Definitive Guide

Previous Chapter 12
Programming with Windows
Next
 

12.5 Other Window Programming Techniques

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);
If you know you are at the top, and want to scroll down 100 pixels, you might write:

self.scroll(0,100);
Note that the scroll() method is not as useful as it could be because there is no way to find out how big the window is, and there is no way to find out how many pixels tall each line of text is.

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.


Previous Home Next
Frame Programming Techniques Book Index The Navigator, Location, and History Objects

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell

file: /Techref/language/java/SCRIPT/definitive/ch12_05.htm, 6KB, , updated: 2019/10/14 15:00, local time: 2024/11/23 09:36,
TOP NEW HELP FIND: 
18.116.40.151: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?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://techref.massmind.org/Techref/language/java/SCRIPT/definitive/ch12_05.htm"> [Chapter 12] 12.5 Other Window Programming Techniques</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to massmind.org!

 

Welcome to techref.massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .