一个强制弹出窗口的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>



相关文章:

  • 2021-11-30
  • 2022-02-08
  • 2021-08-14
  • 2021-07-09
  • 2022-12-23
  • 2022-12-23
  • 2021-09-13
猜你喜欢
  • 2021-07-31
  • 2022-12-23
  • 2022-01-06
  • 2022-12-23
  • 2021-06-20
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案