homepage Welcome to WebmasterWorld Guest from 54.211.219.178
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 and iFrames
mcanada




msg:1478667
 10:17 pm on Jan 12, 2005 (gmt 0)

I'm a JavaScript newbie and need some guidence in regards to iFrames and focus.

I have an html file that creates 2 iframes (frame01 and frame02). They are initially empty. What I would like to do is when a user clicks on a link, I would like to have the contents of that html go into frame01. If they click on another link that contents would go into frame02.

Is it possible thru JavaScript to set the "focus" to the desired iFrame before receiving the html content that will go inside of it?

Thanks

 

MikeFoster




msg:1478668
 6:31 pm on Jan 21, 2005 (gmt 0)

Is it possible thru JavaScript to set the "focus" to the desired iFrame before receiving the html content that will go inside of it?

Yes... but why not just use the 'target' attribute of the A element?

btw... Welcome to WebmasterWorld :)

mcanada




msg:1478669
 6:50 pm on Jan 21, 2005 (gmt 0)

Thanks Mike!

Yes I am now using target= which has been the easiest for me. However we do have a future requirement that would require us to update content in multiple iframes.

I was looking at it from this viewpoint:

focus to iframe 1
send html from server
focus to iframe 2
send html from server
....

I'm not sure that this kind of thing can be done. Understand that I am not working in a PHP or ASP environment. We have our own environment talking to Apache Server. Our environment can output content to the browser as well as receive.

MikeFoster




msg:1478670
 8:17 pm on Jan 21, 2005 (gmt 0)

Some variation of the technique used in this demo [cross-browser.com] might be what you need.

mcanada




msg:1478671
 8:51 pm on Jan 21, 2005 (gmt 0)

Thanks Mike for the link. I'll check it out.

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