动态增加的每行里有一个文本域<input type="text" id="aa">后面跟着一个<img id="imag1" src="xx.gif" onClick="open1(this)"/>用于打开一个子窗口,在子窗口选择相应的值返回到input文本域内。

解决方案 »

  1.   

    a页面:<head id="Head1" runat="server">
        <title>无标题页</title>
        <script type="text/javascript">
            function newWindow()
            {
                window.open("Default4.aspx","haha","height=100,width=400,top=0,left=0,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no",null);
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <input id="Button1" type="button" value="button" onclick="newWindow()" />
            <input id="Text1" type="text" />
        </div>
        </form>
    </body>新打开的页:
    [code=HTML]
    <head runat="server">
        <title>无标题页</title>
        <script type="text/javascript">
            window.opener.document.getElementById('Text1').value='haha!';
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            qqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
        </div>
        </form>
    </body>
    code]
    打开新页面后,原页面的文本框值就变成haha!了。[/
      

  2.   

    这个我懂,我要的<input ...>的id是不同的,不是要每个都写吧!
      

  3.   

    用modaldialog('URL',this)
    第二个是参数.也就是你的INPUT
    在打开的窗口中可以通过window.dialogArguments拿到.
    直接window.dialogArguments.value='xx'来赋值
      

  4.   

    在a页面:
    定义一个div,id随便
    <div id="AllLine"></div>js这么写:var DivAll = document.getElementById("AllLine");
    var n=0
    function CreateLine() {
      var Divline = document.createElement(“div”); 
      var lineInput = document.createElement(“input”); 
      var lineImg = document.createElement(“img”);
     
      Divline.setAttribute("id","Divline_" + n);
      lineInput.setAttribute("id","lineInput_" + n);
      lineImg.setAttribute("id","lineImg_" + n);  lineImg.src= "xx.gif"; 
      lineImg.onclick = function () { openWin();}; //openWin()这里没写
      
      Divline.appendChild(lineInput);
      Divline.appendChild(lineImg);
      DivAll.appendChild(Divline);
    }
    b页面用
    window.opener来返回值就行
      

  5.   


    难道是这样的效果:1、 a.htm<html>
    <head>
    <script language="javascript">
    function openurl(obj){
    var v=document.getElementById(obj).value;
    var u="b.htm?id="+obj+"&v="+v;
    var s="width=400,height=20,top=300,left=400";
    window.open(u,"editd",s);
    }
    </script>
    </head>
    <body>
    <script language="javascript">
    for(var i=1;i<=10;i++){
    var aa="<input type=\"text\" value=\"项目"+i+"\" readOnly id=\"id"+i+"\" \/> <img id=\"image"+i+"\" align=\"absmiddle\" height=\"20\" width=\"30\" alt=\"点击修改\" src=\"xx.gif\" onClick=\"openurl('id"+i+"')\" \/> <br><br>";
    document.write(aa);
    }
    </script>
    </body>
    </html>
    2、 b.htm<html>
    <head>
    <script language="javascript">
    function show(){
    var xx=location.search;
    xx=xx.split("&");
    xx[0]=xx[0].split("=");
    xx[1]=xx[1].split("=");
    document.getElementById("ss").value=xx[1][1];
    document.getElementById("ss0").value=xx[1][1];
    document.getElementById("id").value=xx[0][1];
    }
    function saved(){
    var ss=document.getElementById("ss").value;
    var id=document.getElementById("id").value;
    window.opener.document.getElementById(id).value=ss;
    window.close();
    }
    </script>
    </head>
    <body onLoad="show();focus();">
    <input type="text" id="ss" value="">
    <input type="hidden" id="ss0" value="">
    <input type="hidden" id="id" value="">
    <input type="button" value="确定修改" onClick="saved()">
    <input type="button" value="恢复原样" onClick="ss.value=ss0.value">
    </body>
    </html>
      

  6.   


    值可以传到了,Thanks!请问如果用window.showModalDialog呢?