showModalDialog 打开独占方式网页对话框
window.showModalDialog
打开一个独占方式网页对话框
话法|Syntax
variant = object.showModalDialog(sURL [, vArguments [, sFeatures]])
参数 描述
sURL 指点URL文件地址
vArguments
sFeatures 窗口对话框参数 参数包括下面 可选
dialogWidth:number 设置对话框宽度. 可选
dialogHeight:number 设置对话框高度. 可选
dialogTop:number 设置对话窗户的最高的位置放相对桌面的上面的位置 可选
dialogLeft:number 设置对话窗户左边的位置放相对桌面的左边的位置可选
center:{yes | no | 1 | 0 } 对话窗口出位位置 yes|1居中 NO|0 默认 可选
Help: {yes|no 1|0} 对话框是否出现帮助按钮 可选
scroll: {yes|no 1|0} 对话框是否出现滚动栏 可选
status: {yes|no 1|0} 对话框是否出现状态栏 可选
传入参数:
要想对话框传递参数,是通过vArguments来进行传递的。类型不限制,对于字符串类型,最大为4096个字符。也可以传递对象,例如:
test1.htm
====================
<script>
var mxh1 = new Array("mxh","net_lover","孟子E章")
var mxh2 = window.open("about:blank","window_mxh")
// 向对话框传递数组\\r
window.showModalDialog("test2.htm",mxh1)
// 向对话框传递window对象\\r
window.showModalDialog("test3.htm",mxh2)
</script>
test2.htm
====================
<script>
var a = window.dialogArguments
alert("您传递的参数为:" + a)
</script>
test3.htm
====================
<script>
var a = window.dialogArguments
alert("您传递的参数为window对象,名称:" + a.name)
</script>
返回参数
可以通过window.returnValue向打开对话框的窗口返回信息,当然也可以是对象。例如:
test4.htm
===================
<script>
var a = window.showModalDialog("test5.htm")
for(i=0;i<a.length;i++) alert(a[i])
</script>
test5.htm
===================
<script>
function sendTo()
{
var a=new Array("a","b")
window.returnValue = a
window.close()
}
</script>
<body>
<form>
<input value="返回" type=button onclick="sendTo()">
</form>
window.showModalDialog
打开一个独占方式网页对话框
话法|Syntax
variant = object.showModalDialog(sURL [, vArguments [, sFeatures]])
参数 描述
sURL 指点URL文件地址
vArguments
sFeatures 窗口对话框参数 参数包括下面 可选
dialogWidth:number 设置对话框宽度. 可选
dialogHeight:number 设置对话框高度. 可选
dialogTop:number 设置对话窗户的最高的位置放相对桌面的上面的位置 可选
dialogLeft:number 设置对话窗户左边的位置放相对桌面的左边的位置可选
center:{yes | no | 1 | 0 } 对话窗口出位位置 yes|1居中 NO|0 默认 可选
Help: {yes|no 1|0} 对话框是否出现帮助按钮 可选
scroll: {yes|no 1|0} 对话框是否出现滚动栏 可选
status: {yes|no 1|0} 对话框是否出现状态栏 可选
传入参数:
要想对话框传递参数,是通过vArguments来进行传递的。类型不限制,对于字符串类型,最大为4096个字符。也可以传递对象,例如:
test1.htm
====================
<script>
var mxh1 = new Array("mxh","net_lover","孟子E章")
var mxh2 = window.open("about:blank","window_mxh")
// 向对话框传递数组\\r
window.showModalDialog("test2.htm",mxh1)
// 向对话框传递window对象\\r
window.showModalDialog("test3.htm",mxh2)
</script>
test2.htm
====================
<script>
var a = window.dialogArguments
alert("您传递的参数为:" + a)
</script>
test3.htm
====================
<script>
var a = window.dialogArguments
alert("您传递的参数为window对象,名称:" + a.name)
</script>
返回参数
可以通过window.returnValue向打开对话框的窗口返回信息,当然也可以是对象。例如:
test4.htm
===================
<script>
var a = window.showModalDialog("test5.htm")
for(i=0;i<a.length;i++) alert(a[i])
</script>
test5.htm
===================
<script>
function sendTo()
{
var a=new Array("a","b")
window.returnValue = a
window.close()
}
</script>
<body>
<form>
<input value="返回" type=button onclick="sendTo()">
</form>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货