showmodaldialog方法,showmodaldialog 返回值

showmodaldialog方法,showmodaldialog 返回值,JS中showModalDialog 的使用解析

JS中showModalDialog的使用分析,需要的朋友可以参考一下。

基本介绍:

window.showModalDialog()方法用于创建显示HTML内容的模式对话框。(即父窗口打开后不能操作,只能在模式窗口关闭时操作)

window.showModelessDialog()方法用于创建显示HTML内容的无模式对话框。(即打开后仍可进行其他操作)

用法:

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

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

参数描述:

SURL参数,类型:字符串。用于指定要在对话框中显示的文档的URL。

变量-可选参数,类型:变量。用于向对话框传递参数。传递的参数类型不限,包括数组等。通过对话框窗口获取传递的参数。对话框参数.

SFeatures -可选参数,类型:string。用于描述对话框的外观和其他信息,可以使用下列一项或多项,用分号“;”分开。

-

参数传递:1。如果希望对话框传递参数,则通过变量传递。类型不限。对于字符串类型,最大长度为4096个字符。你也可以传递对象parent.html

复制的代码如下:body username:input id=' username id ' type=' text ' readonly/input id=' button ' type=' button ' value=' select input '/script type=' text/JavaScript ' varsurl=' show modal dialog 2 . html ';//将父窗口对象传递给子窗口var vArguments=windowvar s features=' dialog height:200 px;对话宽度:450像素;文档。getElementByid ('buttonid ')。onclick=function(){//单击‘选择输入’按钮,会弹出一个对话框供您选择输入窗口。显示模态对话框(Surl,Varguments,Features);}/脚本/正文

children.html

复制的代码如下:body script type=' text/JavaScript '//点击'选择输入'按钮后,对应的值会显示在父窗口的文本框中。//从父窗口接收对象var father window=window . dialog arguments;Select函数input(input element){//获取用户名varusername=input elementparentnodenextsibling第一胎;nodevalue//将用户名设置为与父窗口相关的位置:father window . document . getelementbyid(' Username ID ')。值=用户名;}

/script table border=' 1 ' align=' center ' tr th operation/th user name/th/tr tr TD input type=' button ' value=' select input ' onclick=' select input(this)'//TD TD TD张三/td /tr

/表/正文最终结果:

2.可以通过window.returnValue向打开对话框的窗口返回信息,可以是布尔值、整数值等。也可以是js数组,当然也可以是对象。

parent.html

复制的代码如下:script type=' text/JavaScript '/* * Turn通过controller在模拟窗口加载JSP页面* */function select userlist(param){ var sur=' $ { pagecontext . request . context path }/selectuser controller/seluser . do?checkTip=' param . check type ' regField=' param . regField ';var变量=windowvar sFeatures=' scrollbars=no可调整大小=否;求助=没有;状态=否;中心:有;dialogHeight=580pxdialog width=776 px“”;return window . showmodaldialog(sURL,vArguments,s features);

}

/* * *通过JSON传递值并返回一个JSON数组* */function getuser(){ var RetValue=select userlist({ ' check type ':' ',' regfield ':' more ' });/脚本

郑重声明:本文由网友发布,不代表盛行IT的观点,版权归原作者所有,仅为传播更多信息之目的,如有侵权请联系,我们将第一时间修改或删除,多谢。

留言与评论(共有 条评论)
   
验证码: