View Full Version : DOM location of iframe
07-26-2004, 03:00 AM
Also, how can i get it too update if the location of the iframe changes?
07-26-2004, 06:35 PM
Well if you assign the iFrame an id, then you can use document.getElementById() to retrieve it:
<iframe id="id_name" ...></iframe>
var i_frame = document.getElementById('id_name');
So whatever id you assign to the iFrame, you need to use the same id to retrieve it using getElementById().
Let me know how it goes,
07-27-2004, 01:00 PM
yeh ive done that. what ive got is
with content being the iframe id.
but how do i find the src or location of the iframe? ie which page is displayed?
07-27-2004, 01:01 PM
whoop, sorry i didnt read your post properly (a little drunk!) thanx mate, ill give it a whirl
07-27-2004, 01:25 PM
yeh works a treat. but the problem is, how do i get it torefresh the variable once the page has changed inside the iframe?
07-27-2004, 06:30 PM
So when will the page within the iFrame get changed? Only when an item from the nav bar is selected, correct? Are there links in the pages within the iFrame? It might be tricky (I'm not sure if there's an event of some kind that you can handle for this..) if the page in the iFrame can change with the user needing to click on the main frame.
If this is the case, it may be better to scrap the iFrame idea, and move to using a DIV and server side using includes (using PHP or something...). This will require the page to 'refresh' more, but you'll have better control over it.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.