Welcome to WebmasterWorld Guest from 54.145.44.134

Forum Moderators: open

Message Too Old, No Replies

Javascript and iFrames

     

mcanada

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

10+ Year Member



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

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

10+ Year Member



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

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

10+ Year Member



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

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

10+ Year Member



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

mcanada

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

10+ Year Member



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