function netgyPopUp(targetURL){
this.targetURL = targetURL;
this.open = function (){
var i=window.open("about:blank","_backad","width=750,height=480,toolbar=no,location=no,directories=no,status=yes,resizable=no,scrollbars=no");
i.blur();
i.opener.focus();
//i.location=targetURL;这样可以
i.location=this.targetURL;//为什么这样就不行
}
}
var netgyPopWIn = new netgyPopUp('http://www.ifeng.com');
(function (){
try{
netgyPopWIn.open();
}catch(e){
document.onclick=netgyPopWIn.open;
}finally{
}
})();
见代码内注释,这是什么
this.targetURL = targetURL;
this.open = function (){
var i=window.open("about:blank","_backad","width=750,height=480,toolbar=no,location=no,directories=no,status=yes,resizable=no,scrollbars=no");
i.blur();
i.opener.focus();
//i.location=targetURL;这样可以
i.location=this.targetURL;//为什么这样就不行
}
}
var netgyPopWIn = new netgyPopUp('http://www.ifeng.com');
(function (){
try{
netgyPopWIn.open();
}catch(e){
document.onclick=netgyPopWIn.open;
}finally{
}
})();
见代码内注释,这是什么
this.open = function (){
var i=window.open("about:blank","_backad","width=750,height=480,toolbar=no,location=no,directories=no,status=yes,resizable=no,scrollbars=no");
i.blur();
i.opener.focus();
//i.location=targetURL;这样可以
i.location=this.targetURL;//因为这里的this指向的是你的open的event对象,等于event.srcElement,两个this所指不同
}