tageting two iframes |
tageting two iframes |
ffomega |
Dec 9 2009, 04:55 AM
Post
#1
|
Group: Members Posts: 1 Joined: 9-December 09 Member No.: 10,538 |
Hi, I am making a website for someone and I want it to be done soon....I have the page in the following layout:
The image displayed above is kinda self explanatory. I have tried to use this snippet and it is not working: CODE // javascript <script language="javascript"> function loadFrames(page1,page2) { eval("window.frames.Main.location='"+page1+"'"); eval("window.frames.banner.location='"+page2+"'"); } </script> // href: <a href="java script:twoiframes('Main', 'pagename1.htm', 'banner', 'pagename2.htm')">Link</a> Keep in mind, that this site has 3 'regular' frames, and the right frame contains the two 'iframes'. I want to target the iframes in the right 'regular' frame from the left frame. So, if someone can give me an example of what I need to do to make this work then i'd be very grateful. thanks |
pandy |
Dec 9 2009, 06:40 AM
Post
#2
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
You only have two placeholders in the function parenthesis but four items in the function call. Only the two first will be passed to the function ('Main', 'pagename1.htm'), the others will be ignored. You don't need eval and there are way to many quotes.
If you are making this totally dependent on JS you should let JS write out the link too, so people without JS don't have a dead link. At least don't use JavaScript URLs (href="javascript;...") CODE <script type="text/javascript"> function loadFrames(page1,page2) { window.frames.Main.location=page1; window.frames.banner.location=page2; } </script> HTML <a href="" onclick="loadFrames('http://google.com','http://yahoo.com');return false">Link</a> This is just for demonstration. If you have the link in plain HTML you should have something in the href for those that don't have JS on. |
Darin McGrew |
Dec 9 2009, 01:55 PM
Post
#3
|
WDG Member Group: Root Admin Posts: 8,365 Joined: 4-August 06 From: Mountain View, CA Member No.: 3 |
Please see the FAQ entry How do I update two frames at once? The FAQ talks about regular frames, but iframes are basically the same.
|
Lo-Fi Version | Time is now: 26th April 2024 - 04:40 AM |