`
irsv67
  • 浏览: 29398 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

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这个系统变量相冲突。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics