如果要返回到父窗口的 某个 设置了 ID 的 <div> 中 可以这样
在子窗口 onclick="close()" close() 之前加上 window.opener.document.getElementById('父窗体中某个 div 的 ID').innerHTML = document.getElementById('子窗体中某个 标签').value;
在子窗口 onclick="close()" close() 之前加上 window.opener.document.getElementById('父窗体中某个 div 的 ID').innerHTML = document.getElementById('子窗体中某个 标签').value;
<!----加个id---->
<input style="WIDTH: 127px" name=PolicyId id="PolicyId" >zi.html<!-----以后标签写规范点,什么能嵌套,什么不能---->
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td width="18%" class="bgc_td_c"><a href="fu.html?bdid=100100" onclick="window.opener.document.getElementById('PolicyId').value=this.innerHTML;self.close();" style="color:red"> 编号为100100的记录 </a> </td>
</tr>
</table>
然后在父页面放一个接收该值的控件比如:<input type="text" id="ctrlid">
修改如下:
<script language=javascript>
function doPastValue(){
var pastvalue = document.getElementById("_hidBdid").value;
window.opener.document.getElementById('ctrlid').value = pastvalue;
window.close();
}
</script><table width="100%" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td width="18%" class="bgc_td_c">
<a href="javascript:doPastValue()" style="color:red"> 编号为100100的记录 </a>
</td>
</tr>
</table>
特别谢谢xiuxiaopeng 分到结贴时给你!
xiuxiaopeng 给出的代码可以实现单条记录传值,如果子窗口有多条可以选择的记录改怎么写代码<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td width="18%" class="bgc_td_c"> 编号为100100的记录 </td>
</tr>
<tr>
<td width="18%" class="bgc_td_c"> 编号为100100100的记录 </td>
</tr>
</table>