S
Sean Inglis
Well bizarre to me, anyway.
I've distilled it down to two small files:
testtop.htm
===============================
<html>
<head>
<script language="Javascript">
var TOPTEST = [1,2,3];
alert('hellotop');
alert(TOPTEST instanceof Array);
</script>
</head>
<frameset rows="100%">
<frame src="testchild.htm">
</frameset>
</html>
===============================
and testchild.htm
===============================
<html>
<head>
<script language="Javascript">
function testtop() {
alert('hellochild');
alert(parent.TOPTEST);
alert((parent.TOPTEST) instanceof Array);
}
</script>
</head>
<body>
<h1>body</h1>
<input type="BUTTON" onclick="testtop();" value="test">
</body>
</html>
===============================
A few deprecated features aside, when I load testtop.htm, instanceof
array is true as I'd expect, but when I check this from the button in
testchild.htm, instanceof array is false.
I suspect I'm missing something obvious, as this behaviour is
consistent in IE 6.0, Opera 9.1 and Firefox 2.0.0.1 (all WIN32, I'll
check Linux when I get home).
Any pointers to what I'm missing, or can anyone shed any light on this
behaviour?
Thanks
Sean
I've distilled it down to two small files:
testtop.htm
===============================
<html>
<head>
<script language="Javascript">
var TOPTEST = [1,2,3];
alert('hellotop');
alert(TOPTEST instanceof Array);
</script>
</head>
<frameset rows="100%">
<frame src="testchild.htm">
</frameset>
</html>
===============================
and testchild.htm
===============================
<html>
<head>
<script language="Javascript">
function testtop() {
alert('hellochild');
alert(parent.TOPTEST);
alert((parent.TOPTEST) instanceof Array);
}
</script>
</head>
<body>
<h1>body</h1>
<input type="BUTTON" onclick="testtop();" value="test">
</body>
</html>
===============================
A few deprecated features aside, when I load testtop.htm, instanceof
array is true as I'd expect, but when I check this from the button in
testchild.htm, instanceof array is false.
I suspect I'm missing something obvious, as this behaviour is
consistent in IE 6.0, Opera 9.1 and Firefox 2.0.0.1 (all WIN32, I'll
check Linux when I get home).
Any pointers to what I'm missing, or can anyone shed any light on this
behaviour?
Thanks
Sean