spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

JavaScript Tip of the Week for December 16, 1996: Those Little Odds And Ends

Many a time has this question appeared in my inbox: How do I get the [select menu / billboard / whatever else] to target a link in [another frame / another window / the top window]? I think you get the picture. Well, the answer is easy. In most tips that deal with changing the location of a page, such as the select menus and billboard tip, you will find a line of code that looks something like this:
    window.location = what follows is irrelevant...
This simple line is used on pages across the web to change the location of the current window to a different location. There are variations on it: self.location, window.location.href, etc. Most of these preform basically the same task. However, there are a few variations on this simple line of code that can have a big impact on what it does. For instance, you want to make the select menu change another frame, as opposed to the one it is currently located in, change this line:
    window.location = ...
To this:
    parent.framename.location = ...
In place of framename put the exact name of the frame that you wish to change the location of. What this code says is this, "Look at the current FRAMESET, then look for the frame named 'framename' and set it's location to..." Similarly, if you wish to clear all the frames, like the effect you get when you use TARGET = "_top", use this line of code:
    parent.location = ...
This changes the location of the current FRAMESET, clearing all of the current frames. If you have nested frames, in place of parent put top. Including top will change the location of the uppermost browser window, not just the current FRAMESET. I hope this has answered your question, or any future questions you may have about using the select menus and billboards to target frames.


internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business