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 上也弹不出来,有什么好办法吗一旦解决,高分相送
分不够,会另开一贴给分

解决方案 »

  1.   


    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 这个变量吧
                        }
     
      

  2.   

    在chrome下显示已拦截弹出窗口数 1知道为什么了吧
      

  3.   

    在chrome的选项--->高级选项 中设置允许弹出窗口,就ok了...
      

  4.   

    当然看到,iE8 firefox 下都会有提示,但就是想要在 chrome TT 下一点击就弹出来 有什么好招
      

  5.   

    我测试过可以的function netgyPopUp(targetURL){
        _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;
                    }
                  })();
      

  6.   

    1.建立或者修改你的Chorme加载的快捷方式,在桌面或者开始-程序菜单中的;
    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即可。
      

  7.   

    可以说,很复杂.而且open里的属性对IE7无效.当时这个问题也困扰我很久,最后不得不让步用其他方法代替(当时是做模拟密码框)
      

  8.   

    要不你用DIV层弹出吧,OPEN方法限制太多
      

  9.   

    我以前是用 Popup window 来模拟的本来想找代码给你参考,好象被format掉了,等我回家找找看吧
      

  10.   

    有安全限制 楼主可以借鉴下. 用form提交窗口<script type="text/javascript">
    <!--
        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();" />