showModalDialog基本操作:父子窗口互传参数
发布时间:2018-09-03 16:05 所属栏目:[运营] 来源:站长网
导读:ShowModalDialog基本操作:父子窗口互传参数 父窗口代码: Copy to Clipboard 引用的内容:[www.veryhuo.com]!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://w
ShowModalDialog基本操作:父子窗口互传参数 父窗口代码: Copy to Clipboard![]() <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>父窗口</title> </head> <body> <script type="text/javascript"> function onOpenWindow(){ //showModalDialog的第二个参数是传递给子窗口的值 //在子窗口可以通过window.dialogArguments方法获取 //如果不需要传递,这个参数就用window本身 var obj = document.getElementById("rtnValue").value; var result = window.showModalDialog("window.htm",obj,"dialogWidth:500px;dialogHeight:400px"); if(result != null){ var name = result[0]; document.getElementById("rtnValue").value = name; }} </script> <input name="rtnValue" type="text" id="rtnValue" value="" /> <input type="submit" name="Submit" value="打开子窗口" onclick='onOpenWindow()' /> </body> </html> 子窗口代码: Copy to Clipboard![]() <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>子窗口</title> </head> <body> 请输入要返回的值: <input name="txtName" type="text" id="txtName" /> <input type="submit" name="Submit" value="确定" onclick='onOK();' /> <script type="text/javascript"> document.getElementById("txtName").value = window.dialogArguments;function onOK(){ var runValue=new Array; runValue[0]=document.getElementById("txtName").value; window.returnValue = runValue; window.close();} </script> </body> </html> 文章来自:http://www.cnblogs.com/huanghai/ 【免责声明】本站内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。 |
相关内容
网友评论
推荐文章
-
荣耀60是在2021年12月1日的荣耀发布会上正式上市的,...[详细]
-
高通在去年底的骁龙技术峰会上正式发布了2022年度旗舰...[详细]
-
14999元!NVIDIA RTX 3090 Ti新卡皇售价定了
NVIDIA将推出新卡皇RTX 3090 Ti,这也可以看作是RTX 3...[详细]
-
130W RTX 3060加入!七彩虹将星X15 AT游戏本上线
2月中旬,七彩虹发布了新一代游戏本X15 XS,升级最新...[详细]
-
大疆将举办新品发布会,这次新品的主题是致守护者,将...[详细]
-
显示屏供应链研究公司Display Supply Chain Consultan...[详细]
-
近日,vivo的一款型号为V2196A的新机通过了3C质量认证...[详细]
-
由于机身空间等技术的限制,手机电池现在早就是不可更...[详细]
-
魅族上架iPhone 13 Pro磁吸手机壳 全息幻彩高颜值
魅族推出了iPhone 13 Pro/Max磁吸手机壳,售价均为129...[详细]
-
比iPhone 13 Pro网速快92% P50E的4G还是不错
昨晚的发布会上,华为推出了10多款新产品,其中包括多...[详细]
热点阅读