您的位置:首页 > 其它

子窗口 向父窗口传值

2015-11-23 15:31 190 查看
父窗口:

<script>

function openWin(str) {

window.open(siteurl+"popup/"+str, null,'width=800,height=500');
// 打开窗口

}

</script>

<input type="text" id="title" name="picPath" value="<?php if(isset($pic)) {echo $pic['Path'];}?>" />

<a href="javascript:;" onclick="openWin('searchPic');">图片</a>

子窗口:

<html>

<head>

<title>图片搜索</title>

</head>

<body>

<script>

function getValue() {

window.opener.document.getElementById('title').value = document.getElementById('picPath').value
// 赋值

window.close(); // 关闭窗口

}

</script>

<input type="text" id="picPath" />

<input type="button" value="确定" onclick="getValue()" />

</body>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: