IE的子页面window对象指向(BUG)

今天写例子,加深函数调用的时候,是看函数定义的环境的,竟然发现IE有BUG,无解

//a.html
var ab="parent";
var count=function ()
{
alert(this.ab); //alert(ab);无this都是parent
}
window.open('c.html');
//b.html
var ab="sub";
//window.parent.count();
var count=parent.count;
var a={"ab":123,"count":parent.count};
window.count();//在IE中这个window父对象为parent
a.count();
count();
c.html
var ab="sub";
//window.parent.count();
var count=opener.count;
var a={"ab":123,"count":opener.count};
window.count();//在IE中这个window父对象为parent
a.count();
count();

你可能感兴趣的:(window)