Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

IFRAMEs, JavaScript, ASP

Help wanted: How to reload 2 iframes with one click



4:51 am on Apr 5, 2002 (gmt 0)

I have a problem with a new website I'm developing.

I have a page with say two iframes...

<a href=newpage.htm target=_contents>Newpage</a>

<iframe src=banner.asp>

<iframe src=content.asp target=_contents>


Now, I want to be able to click on a link in either the body or in _contents-iframe and then reload banner.asp while loading a new document for the iframe.

Hope you guys can help me out


6:24 am on Apr 5, 2002 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Ondfisk, welcome to the boards! This is script I use to change 2 frames from one link. Never tried it with iFrames but I think it should work. Since each iFrame is contained as a window object in the window.frames, it should convert just fine.

When you set up each iframe, give it a name - let's use "banner" and "content".

Define the following function in the HEAD or external js file:

function loadFrames(page1,page2) {

Code the links into the main page:

<p><a href="javascript:loadFrames('banner1.asp','content1.asp')">Load Combo #1</a>

<p><a href="javascript:loadFrames('banner2.asp','content2.asp')">Load Combo #2</a>



Featured Threads

Hot Threads This Week

Hot Threads This Month