Everyday NetLog

快捷导航
专栏分类
zhoz blog 重新开张,欢迎继续支持!
Oct 13

防拦截的弹出窗口JS 雨

window.showModelessDialog()方法

window.showModalDialog(sURL [, vArguments] [, sFeatures])
vReturnValue = window.showModelessDialog(sURL [, vArguments] [, sFeatures])

参数说明:

sURL
必选参数,类型:字符串。用来指定对话框要显示的文档的URL。
vArguments
可选参数,类型:变体。用来向对话框传递参数。传递的参数类型不限,包括数组等。对话框通过window.dialogArguments来取得传递进来的参数。
sFeatures
可选参数,类型:字符串。用来描述对话框的外观等信息,可以使用以下的一个或几个,用分号“;”隔开。
  dialogHeight 对话框高度,不小于100px,IE4中dialogHeight 和 dialogWidth 默认的单位是em,而IE5中是px,为方便其见,在定义modal方式的对话框时,用px做单位。
  dialogWidth: 对话框宽度。
  dialogLeft: 距离桌面左的距离。
  dialogTop: 离桌面上的距离。
  center: {yes | no | 1 | 0 }:窗口是否居中,默认yes,但仍可以指定高度和宽度。
  help: {yes | no | 1 | 0 }:是否显示帮助按钮,默认yes。
  resizable: {yes | no | 1 | 0 } [IE5+]:是否可被改变大小。默认no。
  status: {yes | no | 1 | 0 } [IE5+]:是否显示状态栏。默认为yes[ Modeless]

//代码开始:

<body onload="OpenWin();">

<script>
window._open=window.open; window.open=window_new_open; function window_new_open( a,b,c ) { var win; if( c ) win=window._open( a,b,c ); else if( b ) win=window._open( a,b ); else win=window._open( a ); if( win!=null&&!win.closed ) return win; var option='status:0;help:0;dialogleft:10000px;dialogtop:10000px;dialogheight:0px;dialogwidth:0px'; win=showModalDialog( 'op.htm',[a,b,c],option ); return win; } </script> <script> var win=window.open( 'http://www.zhoz.com/' ); win.close( );
</script>


op.htm内容代码:


<title>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</title>
<script>
function window.onload( ) {
var args=window.dialogArguments; var a=args[0]; var b=args[1]; var c=args[2] var win;
if( c ) win=window.open( a,b,c ); else if( b ) win=window.open( a,b ); else win=window.open( a ); window.returnValue=win; window.close( );
}
</script>
作者:zhoz
出处:Everyday NetLog(转载请注明出处)
Tags:
✍ 发表评论

[注册]

  (快捷键:Ctrl + Enter 快速提交)