一個可以不被廣告攔截器攔截的彈出視窗
* 定義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();
* 這樣來使用:
* myWindow.open("URL");
*/