我现在想实现[点击商品选择]这一项的时候弹出一个窗口,选择子窗口中的一项,把其对应的值返回给父窗口,源码如下,<table width=100% border="1"  id="testTbl" bgcolor="#CCCCCC">
     <tr>
      <td align=center width=6%>选择</td><td align=center width=6%>序列</td><td align=center width=8%>选择商品</td><td align=center width=17%>产品名称</td> <td align=center width=17%>型号规格</td><td align=center width=11%>单价</td><td align=center width=11%>数量</td><td align=center width=11%>总价</td>
     </tr>
     <tr>
      <td align=center width=6%><input type='checkbox' value='"+(row+1)+"' name='ck'/></td><td align=center width=6%>序列</td><td align=center width=8%><input type='button' name='cpdj"+(row+1)+"' style='width:100%' value='单击选择商品' onClick='Openss(this)' /></td><td align=center width=17%><input type='text' name='cpname"+(row+1)+"'  style='width:100%;text-align:center' /></td> <td align=center width=17%><input type='text' name='xh"+(row+1)+"'  style='width:100%;text-align:center' ></td><td align=center width=11%><input type='text' name='dj"+(row+1)+"'  style='width:100%;text-align:center' /></td><td align=center width=11%><input type='text' name='sl"+(row+1)+"'  style='width:100%;text-align:center' /></td><td align=center width=11%><input type='text' name='zj"+(row+1)+"'  style='width:100%;text-align:center'/></td>
     </tr>  
   </table>
<script>
function Openss(obj){
        var oval = window.showModalDialog("sel.html",null,"DialogWidth:300px;DialogHeight:200px");
        obj.parentNode.nextSibling.firstChild.value = oval;
        obj.parentNode.nextSibling.nextSibling.nextSibling.firstChild.focus();
    }
</script>sel.html 的页面源码如下:
<table>
 <tr onDblClick="window.close();">
<td align="center">产品名称</td>
<td align="center" height="25">规格型号</td>
    <td align="center">成本价</td>   
<td align="center">233223</td>
<td align="center">
  箱</td>
<td align="center">
  
    </tr>
</table>
请各位帮实现一下,谢谢

解决方案 »

  1.   

    不会吧。楼主都知道用returnValue属性了。还问呀。你在sel.html中添加脚本来设置window.returnValue不就行了?!!!!!
      

  2.   

    opener.docuemnt.all.父窗口元素。value = 子窗口元素值 ;
      

  3.   

    opener.document.getElementById('XX').value = 'a'; 
    也可以换种方式,在子窗口里得到的值,给父窗口的属性设置.应该也差不多吧.
      

  4.   

    opener.document.getElementById('XX').value = 'a'; 
    LZ我说了是这样写的 
    opener 就是返回父窗口的 
    在子窗口写 opener.document.getElementById('XX').value = 'a'; 
    就是返回到父
    可以这样写
    document.getElementById("xx").value=opener.document.getElementById('XX').value = 'a'; 
      

  5.   


    //父:
    p=window.showModalDialog("query.asp","treelist","center:yes;dialogHeight:490px;dialogWidth:378px;help:no;status:no;scrollbars=yes");
    //子:
     window.top.returnValue=document.Form1.name.value+'|'document.Form1.name2.value//父窗口取得后 :
    p.split("|");分隔出每一个值。
      

  6.   

    window.showModalDialog和window.returnValue的应用
    http://blog.csdn.net/eamoi/archive/2004/08/31/89571.aspx
      

  7.   

    模态窗口不传递窗体句柄是无法大子窗口操作爷窗口的,要传递window、this之类的句柄,要改成var oval = window.showModalDialog("sel.html",window,"DialogWidth:300px;DialogHeight:200px");然后子窗口通过dialogArguments去操作父窗口,等同于window.open打开时用opener去操作父窗口一样.