子页面window.parent.document.all.xxx.value=doucument.all.xx.value
window.close()

解决方案 »

  1.   

    <script>
    window.opener.form.ProductImage.value='<%=filename%>';
    window.close();
    </script>
      

  2.   

    请问一楼的,是写在子窗口中的:<select name="select" size="10" multiple>
    中去吗?
    用什么事件处理onclick?还是?
      

  3.   

    <select name="select" size="10" multiple onchange="test();">
    <script>
    function test(){
    window.parent.document.all.xxx.value=doucument.all.xx.value
    window.close()
    }
    </script>
      

  4.   

    刚才的忘了;号
    正确写法
    <select name="select" size="10" multiple onchange="test();">
    <script>
    function test(){
    window.parent.document.all.xxx.value=doucument.all.xx.value;
    window.close();
    }
    </script>
      

  5.   

    双击无反应我把里面的值改为我的:required_name是我父叶面的文本框名字,select是下拉列表框名字。
    window.parent.document.all.required_name.value=doucument.all.select.value;但无反应?
      

  6.   

    应该用opener才对:
    window.opener.document.all.required_name.value=doucument.all.select.value
      

  7.   

    看示例
    1.htm
    <form name="form1">
    <input type="text" name="tt">
    </form>
    <input type="button" onclick="window.open('2.htm','','');" value=" test ">2.htm
    <form name="form2">
    <select name="ss" size="10" multiple onchange="test();">
    <option value="test">test</option>
    <option value="test1">test1</option>
    </form><script>
    function test(){
    window.opener.form1.tt.value=document.form2.ss.value;
    window.close();
    }
    </script>
      

  8.   

    这么神奇?用opener也不行:
        <script>
    function test(){
    window.opener.document.all.required_name.value=doucument.all.select.value
    window.close();
    }</script>
    <form name="cc" method="post" action="">
    <select name="select" size="10" onchange="test();">
    <option value="A">AAA</option>
    </select>
    </form>
      

  9.   

    怎么诡异?改成这样:    
    <script>
    function test(v){
    window.opener.document.all.required_name.value=v;
    window.close();
    }</script>
    <form name="cc" method="post" action="">
    <select name="select" size="10" onchange="test(this.value);">
    <option value="A">AAA</option>
    <option value="B">BBB</option>
    </select>
    </form>
      

  10.   

    window.opener.form.ProductImage.value='<%=filename%>';
    window.close();
      

  11.   

    传回的是:value="A"
    我想传回的是NAME,怎么改?
      

  12.   

    不是啊,楼上的:
    <option value="A">AAA</option>
    A在我这里是ID,而AAA是名字来的,,我想传回名字
      

  13.   

    给你提供思路吧通过getElementByName("select")得到元素对象,再通过childNodes获得所有option,遍历nodes判断其值是否为A如果相等则取出innerText传回,并退出循环。
      

  14.   

    好事做到底吧!!
    <form name="cc" method="post" action="">
    <select name="select" size="10" onchange="f_select(this);">
    <option value="A">AAA</option>
    <option value="B">BBB</option>
    <option value="c">ccc</option>
    <option value="d">ddd</option>
    </select>
    </form>
    <script>
    function f_select(obj)
    {
    alert(obj.value);
    for(var i=0;i<obj.childNodes.length;i++)
    {
    if(obj.childNodes[i].value==obj.value)
    {
    opener.document.all.required_name.value=obj.childNodes[i].innerText;
    break;
    }
    }

    }
    </script>
      

  15.   

    我觉得最好使用showModalDialog<html>
    <head>
    <script language="JavaScript">
    <!--function _open(){
    var R = showModalDialog(document.location,"","dialogWidth:200px;dialogHeight:20px;center:yes;help:no;scroll=no;resizable:no;status:no");
    alert(R);
    }function _close(){
    window.returnValue = R.value;
    window.close();
    }
    //-->
    </script>
    </head><body onerror="return false">
    </body>
    <script language="JavaScript">
    <!--
    try {
    dialogArguments;
    document.body.innerHTML = '<input type="text" id="R" value="返回值"><input type="button" value="关闭" onclick="_close();">';
    } catch (e) {
    document.body.innerHTML = '<a href=javascript:_open();>打开</a></p>Time:&nbsp;' + new Date();
    }
    //-->
    </script>
    </html>