可以不被浏览器拦截的弹出窗口

一个强制弹出窗口的JavaScript类,存放在JS文件,直接一个函数调用即可,但是此弹出窗口不能自定义样式、宽、高等参数,部分高版本的浏览器已经能够拦截此窗口

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){
this.f.action = sUrl;
this.f.submit();
}
window.force = new ForceWindow();

调用的代码

<script language="javascript">
window.force.open('http://www.sharejs.com');
</script>



posted on 2012-03-07 14:00  魔GUI  阅读(280)  评论(0编辑  收藏  举报

导航