首页 > 网站 > WEB开发 > 正文

Javascript模态对话框 取父页的值

2024-04-27 14:02:40
字体:
来源:转载
供稿:网友

1. a.htm   父页
有 window.showModalDialog("b.htm");
有 Html元素 <input type="text" id="t1" name="t1" value="value">

2.b.htm 弹出页面

能否在 b.htm 上取到 a.htm 中 t1的值 ?

回答:

在a.html中设置

var results = window.showModalDialog("b.html");

if(results){

    alert(results["key"]);

}

 

在b.html中

<script>

window.returnValue={

      key:"返回到父页面"

}

</script>


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表