当前位置: 首页 > 图文教程 > 网络编程 > Javascript > 可以不被浏览器拦截的弹出窗口JS代码

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript 中的 可以不被浏览器拦截的弹出窗口JS代码


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-28   浏览: 272 ::
收藏到网摘: n/a

一个强制弹出窗口的JavaScript类:ForceWindow

一个可以不被广告拦截器拦截的弹出窗口

ForceWindow.iclass.js代码如下(使用、讲解、相关说明全部在注释中):

------------------------------------------------------------------------------------

/**
 * 定义ForceWindow类构造函数
 * 无参数
 * 无返回值
 */
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]);
}

/**
 * 定义open方法
 * 参数sUrl:字符串,要打开窗口的URL。
 * 无返回值
 */
ForceWindow.prototype.open = function (sUrl)
{
  this.f.action = sUrl;
  this.f.submit();
}

/**
 * 实例化一个ForceWindow对象并做为window对象的一个子对象以方便调用
 * 定义后可以这样来使用:window.force.open("URL");
 */
window.force = new ForceWindow();

/**
 * 用本程序弹出的窗口将不会被广告拦截软件拦截,但有一个缺点:你无法象对window.open弹出的窗口那样对外观进行定制。
 * 你当然也可以在使用前实例化一个ForceWindow对象:
 * var myWindow = new ForceWindow();
 * 这样来使用:软晨学习网http://www.ruanchen.com
 * myWindow.open("URL");
 * 本程序测试通过的浏览器:IE 5+、Firefox 1.0、Mozilla 1.7.5、Netscape 7.2、Opera 7.23
 * 友情提示:如果你将本程序用于强制弹出广告,请更多的想想浏览者的感受!
 */
------------------------------------------------------------------------------------