呵呵,今天在同事的威逼下上网上查找一段关于showModalDialog的参数问题。说实话,之前还真没用过,为防以后再用,所以在此备份一份。
<html>
<head>
<script>
function open_Dialog(){
//将本页面对象传给子窗体;
obj2 = document.getElementById("b1");
str=window.showModalDialog("2.html",obj2,"dialogWidth=200px;dialogHeight=100px");
// 获取子窗体返回的对象;
alert(str);
}
</script>
</head>
<body>
<form id="form1">
<input type="button" value="打开模式窗体" onclick="open_Dialog();" id="b1">
</form>
</body>
2.html
<htmL>
<head>
<script language="javascript">
//接收父窗体穿来的参数对象用window.dialogArguments;
var obj = window.dialogArguments;
alert("您传递的参数为:" + obj.value);
obj.value = "san";
//向父窗体返回值用window.returnValue
window.returnValue="/";
</script>
</head>
<body >
ddddd
</body>
</html>