Log in

View Full Version : control div on other page



joesatriani
02-04-2008, 09:00 AM
Hello,

I was wondering if it is possible to control a div on another page.
For instance:

When you work with 2 iframes, is it possible to show a page in the first iframe, when there is a link clicked in the second?

Not that i want to do the above example, but just to make it clear for you all.

thanks,
Dennis,
the Netherlands

Jas
02-04-2008, 07:27 PM
Hmm. That seems like two different questions. Well, the first part (controlling a div in another frame):

Controling iframes is possible using javascript. You would need to reference the frame you want to manipulate in a similar way to how you would reference a div or span tag. Here is an example taken from this (http://www.devarticles.com/c/a/JavaScript/Working-with-IFRAME-in-JavaScript/) tutorial:


function ShowWebSite(val)
{
document.all.myFrame.src=val;
document.all.myFrame.style.visibility="visible";
}

Read the tutorial for more.

As for linking, put a target in the anchor tag. ie:

<a href="SomeSite.com" target="MyFrame">Click Me!</a>
By default the target is "_top" if I am not mistaken, which tell the browser to change the whole page. You can also have the link open in a new window with the target, but popup blockers usually don't allow that.