View Full Version : changing javascript to open outside iframe
I've got a code at this website: http://www.web-source.net/javascript_redirect_box.htm
I want to put it in the navigation bar that is set up as an iframe, but I don't know what to change to get it to open the pages outside of the iframe.
MattCoz
02-02-07, 09:24 PM
Use this:
parent.location=form.select.options[index].value;
Thanks mucho! That worked perfectly. I'm assuming the "parent" added to the beginning of the line of code there tells the script to open in the parent frame?
Yeah. Parent refers to the parent of the object from which you're referring the property according to the JavaScript hierarchy. Typically when called from within a document, parent usually refers to the outermost object which is window.
and what would I put to have it open inside a new window?
You could do it through your <a> tag. Just add the "target" attribute.
<a href="url" target="_NEW">Text</a>
That will open a new window. You can also use the same thing to have links from the iframe control the main window and vice versa.
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.