Hi,is anyone bored enough to tell my why this fails?
My index.htm page loads 'script.js':
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" src="../includes/script.js" />
</HEAD>
...
And 'script.js" has this function
function msgWin1(theURL,howWide,howHeigh,whereTop,whereLeft) {
var styleStr = "toolbar=no,scrollbars=yes,resizable=yes,fullscreen=no";
styleStr = styleStr + ",width=" + howWide;
styleStr = styleStr + ",height=" + howHeigh;
styleStr = styleStr + ",top=" + whereTop;
styleStr = styleStr + ",left=" + whereLeft;
var msgWindow1 = window.open(theURL,"msgWindow1", styleStr);
try{
msgWindow1.onload = function(){window.alert("YIPPEE");};
msgWindow1.count=8;
msgWindow1.onload();
msgWindow1.focus();
} catch (err) {
window.alert("ERROR: END");
}
}
I have an onclick in the index page that a user can call to open a second
window and load another page -- "theURL"
The HTML code for the new page in the second window is:
<HTML>
<HEAD>
<LINK href="../css/style.css" type=text/css rel=stylesheet>
<SCRIPT type=text/javascript>
window.alert(this.count);
window.alert(null == this.onload);
window.alert(typeof(this.onload));
</SCRIPT>
</HEAD>
....
Here's the problem.
When the first widow calls msgWin1() it does execute:
msgWindow1.onload()
That does open an alert window with "YIPPEE" in it.
Then, the script in the second window's HEAD uses alert() to:
1. Confirm the this.count property still equals 8
BUT
2. Claims this.onload is null (with typeof 'object' instead of 'fundtion')
How did I keep the msgWindow1.count property, but lost the msgWindow1.onload
function???
Thanx
GLB