子窗口 向父窗口传值
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>
<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>
相关文章推荐
- 优化方法-模拟退火法
- Js 正则表达式特殊字符含义
- GeoPandas官方中文文档--译著
- Jsp+Servlet+JavaBean经典MVC模式理解
- [IOS开发教程] IOS中用NSJSONSerialization来实现对JSON格式的解析
- 欢迎使用CSDN-markdown编辑器
- jquery自定义表格样式
- 形成20位存储单元的物理地址
- Java 回调的概念
- Linux目录结构和常用命令
- nginx配置
- Ubuntu 下安装 apt-get install npm 失败的解决方案
- Android中Bitmap和Drawable详解
- PHP POST CURL上传图片
- 使用Loadrunner 调用Webservice接口测试优化总结
- linux命令---cp 命令
- 生成汉子拼音首字母全部的
- android的HttpURLConnection实现post和get
- 学习站点记录
- ANY数据类型的使用