mad_php Posted October 6, 2008 Share Posted October 6, 2008 Hi, I have two windows i'm working with. When window B opens off the parent window A. Window A has to be open all the time while window B is open. If the user closes down window A, window B need to close also. I have a javascript function inside Window A that is launched on the onunload event. function closePopup(){ main.close(); } main is the name of window B. I keep getting error message when i load window A, it says main is undefined. So basically I want to be able to check to see window B is open before running main.close() Can anyone help me? Thanks --Mark Link to comment https://forums.phpfreaks.com/topic/127238-check-if-window-exists/ Share on other sites More sharing options...
KevinM1 Posted October 6, 2008 Share Posted October 6, 2008 Hi, I have two windows i'm working with. When window B opens off the parent window A. Window A has to be open all the time while window B is open. If the user closes down window A, window B need to close also. I have a javascript function inside Window A that is launched on the onunload event. function closePopup(){ main.close(); } How are you opening the main window (Window B)? Because at first blush, it sounds like you may have a slight runtime collision on your hands, where references to HTML elements are trying to be created before they actually exist in the browser. main is the name of window B. I keep getting error message when i load window A, it says main is undefined. So basically I want to be able to check to see window B is open before running main.close() Can anyone help me? Thanks --Mark Link to comment https://forums.phpfreaks.com/topic/127238-check-if-window-exists/#findComment-658116 Share on other sites More sharing options...
mad_php Posted October 6, 2008 Author Share Posted October 6, 2008 main window B opens from a page deep in the site. Unfortunately the unonload event is run inside a header that is included throughout the site. Link to comment https://forums.phpfreaks.com/topic/127238-check-if-window-exists/#findComment-658122 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.