homepage Welcome to WebmasterWorld Guest from 54.234.2.94
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
javascript for changing two frames on a click
oilman




msg:1489725
 8:54 pm on Aug 15, 2001 (gmt 0)

need a js that will change the contents of two target frames on clikc while leaving the navigation frame standing. It's a 5 frame page with no other way to manage it (don't ask...)

 

tedster




msg:1489726
 5:11 am on Aug 16, 2001 (gmt 0)

Here's one way, oil:

Assume you've named the frames to be changed frame4 and frame5.
Assume the HTML files to be loaded into those frames are newpage1.html and newpage2.html

FUNCTION definition
(goes in the HEAD section or .js file for the HTML of the nav frame)

function doTwo(pageA,pageB)
{
(parent.frame4.location=pageA);
(parent.frame5.location=pageB);
}

LINK
(code for the HTML page)

<a href="javascript:doTwo('newpage1.html','newpage2.html')">ONE LINK changes two frames</a>

WEIRD STUFF
The BACK button will only go back one frame at a time, not both at once. If that's a problem, the only workaround I can think of is forgetting the Javascript and having the link load an entirely new frameset, with the individual frames holding the new HTML documents (and the old documents, for the frames that will remain the same)

oilman




msg:1489727
 3:00 pm on Aug 16, 2001 (gmt 0)

cool - thanks tedster. Just what I was looking for.

mark_roach




msg:1489728
 3:17 pm on Aug 16, 2001 (gmt 0)

Another variation:


<A HREF="page1.htm" target="main"
onClick="parent.frames[3].location.href = 'page2.htm'; return true;">Click Here</A>

You get the same problem with the back button though.

Macguru




msg:1489729
 3:21 pm on Aug 16, 2001 (gmt 0)

mark_roach

I though you would be an advocate of reloading a new frameset, with the sexy NOFRAME you make! :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved