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{
document.onclick=netgyPopWIn.open;
}
})();
在 ie8 firefox3.5 上,一点击就会弹出页面
但在chrome 上一点还是会弹不出来 可能在TT 上也弹不出来,有什么好办法吗一旦解决,高分相送
分不够,会另开一贴给分
function netgyPopUp(targetURL){
this.targetURL = targetURL; //这个this指的是 netgyPopUp 的吧。
....
}this.open = sopen ;
var sopen = 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 指的的是 sopen 这个变量吧
}
_Event=this;
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=_Event.targetURL;//OK
}
}
var netgyPopWIn = new netgyPopUp('http://www.ifeng.com');
(function (){
try{
netgyPopWIn.open();
}catch(e){
document.onclick=netgyPopWIn.open;
}finally{
document.onclick=netgyPopWIn.open;
}
})();
2.右键单击该快捷方式,选择属性;
3.在快捷方式属性的目标属性中,你可以看到Chrome的启动路径:我的为:"F:\Documents and Settings\listening\Local Settings\Application Data\Google\Chrome\Application\chrome.exe",其他操作系统是类似的。
4.在该Url的后面加上-disable-popup-blocking。然后单击应用即可。加上后的URL链接为:
我的操作系统表现为:"F:\Documents and Settings\listening\Local Settings\Application Data\Google\Chrome\Application\chrome.exe" -disable-popup-blocking这样通过为Chome浏览器提供启动参数,阻止了弹出窗口拦截器的拦截。如果你下次需要开启,只需要按同样的步骤,删除后面添加的参数 -disable-popup-blocking即可。
<!--
function ForceWindow (){
this.r = document.documentElement;
this.f = document.createElement("FORM");
this.f.target = "_blank";
this.f.method = "post";
this.r.insertBefore(this.f, this.r.childNodes[0]);
}
ForceWindow.prototype.open = function (sUrl){
/*var ranUrl = "?" + Math.ceil(Math.random()*100);
if(isSafa){
this.f.action = sUrl + ranUrl;
}else{
this.f.action = sUrl;
}
======如果是Safa浏览器 需要加个随机数
*/
this.f.action = sUrl;
this.f.submit();
}
var fw = new ForceWindow();
function openNew(){
fw.open("http://www.baidu.com");
}
//-->
</script>
<input type="button" value=" Submit " onclick="openNew();" />