Welcome to WebmasterWorld Guest from 54.160.254.203

Forum Moderators: open

Message Too Old, No Replies

Javascript and iFrames

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

New User

10+ Year Member

joined:Jan 12, 2005
posts:8
votes: 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

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

Junior Member

10+ Year Member

joined:July 20, 2001
posts:137
votes: 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 :)

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

New User

10+ Year Member

joined:Jan 12, 2005
posts:8
votes: 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.

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

Junior Member

10+ Year Member

joined:July 20, 2001
posts:137
votes: 0


Some variation of the technique used in this demo [cross-browser.com] might be what you need.
8:51 pm on Jan 21, 2005 (gmt 0)

New User

10+ Year Member

joined:Jan 12, 2005
posts:8
votes: 0


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