zoukankan
html css js c++ java
JavaScript 强行弹出窗口 与 无提示关闭页面
<
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
>
查看全文
相关阅读:
IE8及其以下浏览器边框圆角兼容问题
关于git的一些指令及遇到的问题和解决方法
vue项目环境搭建及运行
webpack中的重要功能
webpack 的重要功能
c++ stl sort 自定义排序函数cmp要遵循 strict weak ordering
spring boot 包jar运行
windows上传文件到linux云服务器上
最少硬币数目的问题
leetcode 415 两个字符串相加
原文地址:https://www.cnblogs.com/chenbg2001/p/1704097.html
最新文章
js 日期扩展方法 addMonth addYear
JS 获取上一个月
Python 爬取LOL英雄壁纸
Python 批量打印文件
VurPress
HDU6656 Kejin Player
HDU6655 Just Repeat
HDU6651 Final Exam
HDU6646 A + B = C
HDU6662 Acesrc and Travel
热门文章
HDU6667 Roundgod and Milk Tea
HDU6682 Rikka with Mista
HDU6686 Rikka with Travels
HDU6685 Rikka with Coin
HDU6684 Rikka with Game
HTTP和HTTPS的区别,SSL的握手过程
一些面试题整理
img图片转成base64
html5将图片的绝对路径转换成文件对象
IE8 及其以下 浏览器边框圆角兼容问题
Copyright © 2011-2022 走看看