IE父子窗口的参数及返回值的传递

父窗口:main.html
//------------------------------------------
<html>
<head>
<script language="javascript">
function getValue(){
  var sta="dialogWidth:400px;dialogHeight:200px;status:no;help:no;center:yes";
  var para="this is the parameter";
  var value="1";
  value=window.showModalDialog("getValue.html",para,sta);
  alert(value);
}
</script>
</head>
<body>
<center>
<a href="#" onclick="getValue()">从子窗体获得输入值</a>
</center>
</body>
</html>


子窗口:getValue.html
//--------------------------------------
<html>
<head>
<script language="javascript">
function init(){
  var para=window.dialogArguments;
  document.getElementById("para").innerHTML=para;
}
function getValue(){
  window.returnValue="this is the return value";
  window.close();
}
</script>
</head>
<body onload="init()">
<center>
<div id="para"></div>
<a href="#" onclick="getValue()">提交返回值</a>
</center>
</body>
</html>


注意:子窗口的getValue()函数名不能用“returnValue”,这样会与windows.returnValue这个系统变量相冲突。

你可能感兴趣的:(html,windows,IE)