Click to See Complete Forum and Search --> : onload and onunload


mwong7025
June 16th, 2005, 01:35 PM
I have web server program, I want to pass the onload and onunload event back to the to main page from the popup page. I am getting the error “window.opener is NULL or not an object” when I try to create the popup.
The following is how I create the popup:
A button is clicked on the main page, this send to my web server program to create the popup
My popup page is like the following:
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body onload="window.opener.callToServer(4)" onUnload="window.opener.callToServer(5)">
<script type="text/javascript">
window.open('\ErrorLog.html', 'log','width=800,height=600,menubar,resizable,menubar=0')
</script>
</body>
</html>

Dr. Script
June 16th, 2005, 01:58 PM
Is this page located on the same server? If so, is it online anywhere to test. I don't recognize any bugs.

Although, it is common practice to use 1 case for event handlers and names of attributes (onunload, rather than onUnload).

mwong7025
June 16th, 2005, 02:06 PM
Is that maybe my window.open is in the popup page, so the window.opener reference in the popup is not valid? I really want to send the load and unload event back to the main page. Both the main page and the popup are in the same server.

Dr. Script
June 16th, 2005, 03:16 PM
I don't see any problems. Is it online anywhere?