JavaScript 強行快顯視窗 與 無提示關閉頁面

來源:互聯網
上載者:User
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>無標題文檔</title>
<script type="text/javascript">
/**//**
 * 定義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.force.open("http://163.com")
/**//**
 * 用本程式彈出的視窗將不會被廣告攔截軟體攔截,但有一個缺點:你無法象對window.open彈出的視窗那樣對外觀進行定製。
 * 你當然也可以在使用前執行個體化一個ForceWindow對象:
 * var myWindow = new ForceWindow(); 
 * 這樣來使用:網頁教學網http://www.webjx.com
 * myWindow.open("URL");
 * 本程式測試通過的瀏覽器:IE 5+、Firefox 1.0、Mozilla 1.7.5、Netscape 7.2、Opera 7.23
 * 友情提示:如果你將本程式用於強制彈出廣告,請更多的想想瀏覽者的感受!
 */
<!--強制關閉-->
window.opener   =   "meizz"; 
window.close();
</script>
</head>

<body>


</body>
</html>
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.