woolyg Posted October 12, 2008 Share Posted October 12, 2008 Hi all, Within an HTML page of mine, I have embedded an IFrame. Within the Iframe is a little snippet of JS code that calls a overlay, and displays something over the whole page. Problem is, the overlay DIV I want to call is actually housed on the main HTML page, not within the Iframe. Is it possible to getElementByID from a main page, when calling it from within an Iframe? I keep getting "divname is undefined" errors because the divname is not locate in the Iframe code. All input appreciated, Thanks. WoolyG Link to comment https://forums.phpfreaks.com/topic/128125-solved-getelementbyid-in-a-different-frame/ Share on other sites More sharing options...
woolyg Posted October 12, 2008 Author Share Posted October 12, 2008 Found it - In my JS I used obj1 = parent.top.document.getElementById('overlay_1'); ..this calls the object from the parent frame, rather than attempting to call it from within the Iframe. Nice one! Link to comment https://forums.phpfreaks.com/topic/128125-solved-getelementbyid-in-a-different-frame/#findComment-663537 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.