Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-24-2008, 03:31 AM   PM User | #1
cait4804
New to the CF scene

 
Join Date: Dec 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
cait4804 is an unknown quantity at this point
iframe onload

I am not very familiar with JavaScript, but I am trying to use iframes.

I have a gallery as part of my website, and I am using iframes to change the large photo that is currently showing, as well as to change a secondary nav bar. Everything is working for the gallery, except when I first open it the iframes are empty.

I want to be able to click on a link from my regular website and open it in the gallery in the iframe. I figured I needed to add an onload event to the link. To make it more difficult, I want the link to open 3 specific things in 3 iframes in the gallery. I can't have the gallery always open with the same 3 images showing because they need to change depending on which link is used to open the gallery.

Check it out at ckdesigns.biz Click on "Gallery" and you will see the empty iframes. If you then click on "Puppies" in the Gallery it will show one of the iframes, then click on "Bill" and it will show the other 2. (These are the only links for iframes I have working right now.)

Thank you so much for the help!!!
cait4804 is offline   Reply With Quote
Old 01-21-2009, 03:13 AM   PM User | #2
cait4804
New to the CF scene

 
Join Date: Dec 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
cait4804 is an unknown quantity at this point
Smile I Figured It Out!!!!!

After days and days of googling my problem, I finally tried something that worked, and it was all too simple!

This is what I ended up putting in the body tag of my gallery page that has the iFrames on it:

<body onload="iFrameName.location='iFrameContent.html'">

Where "iFrameName" is the name of the iFrame I am targeting, and "iFrameContent.html" is the .html file I want to initially open in the iFrame when the gallery page is first opened. If you have multiple iFrames you don't want empty when the page opens, the code would look like this:

<body onload="iFrameName1.location='iFrameContent1.html', iFrameName2.location='iFrameContent2.html'">

In my case, I need the gallery page to open with different things showing in the iFrames, depending on which link took you to the gallery page. So...what I will do is create multiple gallery "start" pages and change the <body onload=...> tag.

I hope this helps someone. I found a lot of people with the same problem and no responses, so here you go!

You just need to make sure that the .html file you want to open in the iFrame has the correct path according to whatever page your iFrames are on.
cait4804 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:58 PM.


Advertisement
Log in to turn off these ads.