点击"会员列表"按钮,弹出窗口可以选择,根据列表选择自动在文本框内,然后确定,自动返回到页面如下图,点击会员列表按钮弹出窗口如图,根据会员列表点击会员名可以自动到上边的文本框,
然后关闭这个弹出窗口,会员列表按钮旁边的文本框就有内容了
需求这样类似的代码示例,

解决方案 »

  1.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title>父页面</title>
    </head>
    <body>
    指定用户名:<input id="Text1" type="text" />
    <input id="Button1" type="button" value="会员列表" onclick="window.open('../JS/Child.htm')" />
    </body>
    </html>
      

  2.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title>无标题页</title>
    </head>
    <body>
    <p>这里是子窗口</p>
    <input id="txt2" type="text" value="ws_hgo" />
    <input id="Button1" type="button" value="返回父窗口" onclick="window.opener.document.getElementById('Text1').value=document.getElementById('txt2').value;window.close()" />
    </body>
    </html>
      

  3.   

    MainPage.html<html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title></title>
        <script language="javascript">
            function ChooiceOne() {
                var value = window.showModalDialog("UserList.html","xxx");
                document.getElementById('txtName').value = value;
            }
        </script>
    </head>
    <body>
    <label>姓名:<input type="text" id="txtName" /></label><input type="button" onclick="ChooiceOne();" />
    </body>
    </html>UserList.html页<html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title></title>
        <script language="javascript">
            function selectOne(link) {
              //  this.opner.document.getElementById("txtName").value = "xx";
                window.returnValue = link.innerHTML;
                window.close();
            }
        </script>
    </head>
    <body>
    <a href="#" onclick="selectOne(this);">唐sir</a>
    <br />
    <a href="#" onclick="selectOne(this);">孙大</a>
    </body>
    </html>