首页 > 其他 > 详细

模态窗口的运用

时间:2014-08-19 12:44:14      阅读:320      评论:0      收藏:0      [点我收藏+]

1   在主窗体

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script type="text/javascript">
function testModalDialog()
{
var p = new Object();
p.name = "chengdong";
var res = window.showModalDialog("2.html", p);
alert("返回值" + res);

}

</script>
</head>
<body>
<a href="javascript:testModalDialog()">弹出模态窗口</a>
</body>
</html>

 

 

 

2  弹出的窗体

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>我是模态窗体</title>
<script type="text/javascript">

var obj = window.dialogArguments;
alert("你传递的参数是"+obj.name);
function closeWin()
{
window.returnValue = document.getElementById("txtName").value;
window.close();
}
</script>
</head>
<body>
模态窗体赶回值给父窗体
<input type="text" id="txtName"/>
<input type="button" value="关闭" onclick="closeWin()" />
</body>
</html>

模态窗口的运用,布布扣,bubuko.com

模态窗口的运用

原文:http://www.cnblogs.com/cdaq/p/3921574.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!