在B页面好象没有 name=xz 的文本框吧, 且按钮用button就可以了不必用submit

解决方案 »

  1.   

    不好意思啊
    写错了
    我改正一下
    b页面的代码
    <SCRIPT language="JavaScript">
    function getValue()
    {
       opener.write(document.all.yhmc.value);
    }
    </script>
    <input type="text" name="yhmc">
    <nput type="button" name="Submit" value="按钮" onClick="getValue()">
    我随便在文本框输入点东西,
    可是这个结果在a页面得到的是undefined
      

  2.   

    Post.htm<input type=text name=maintext>
    <input type=button onclick="window.open('Read.htm')" value="Open">Read.htm<script language="javascript" >
    //window.open打开的窗口.
    //利用opener指向父窗口.
    var parentText = window.opener.document.all.maintext.value;
    alert(parentText);
    </script>
      

  3.   

    a.htm
    <input type=button onclick="window.open('b.html')" value="Open">
    <input type="text" name="yhmc">b.htm
    <SCRIPT language="JavaScript">
    function getValue()
    {
      var parentText = window.opener.document.all.yhmc.value;
      document.all.yhmc.value=parentText;}
    </script><input type="text" name="yhmc">
    <input type="button" name="Submit" value="按钮" onClick="getValue()">
      

  4.   

    以前做的,希望能有用 ...-------main.asp----------<html>
        <head>
            <title>Login</title>
            <script language="javascript">
            <!--
                function Win_open(strif)
                {
                    if (strif == '1')
                    {
                        window.open("Tel.asp",'newwindow', 'height=100, width=400, top=0,left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
                    }
                }
            //-->
            </script>
        </head>
        <body>
            <form name="form1">
                <table>
                    <tr>
                        <td>
                            <select name=class size="1" onchange="Win_open(this.value);">
                            <option  value="0"  selected>普通用&#25143;</option>
                            <option value="1" >VIP用&#25143;</option>
                            </select>
                        </td>
                        <td>
                            您的手机号:<input name="T1" size="30" disabled>
                        </td>
                    </tr>
                </table>
            </form>
        </body>
    </html>
    ----------------- Tel.asp ------------------<html>
        <head>
            <title>PhoneCode</title>
            <script language="javascript">
            <!--
                function Win_close()
                {
                    if (document.form1.TT1.value == '')
                    {
                        alert(" 必須填入手机号!");
                    }
                    else
                    {
                        window.opener.document.form1.elements['T1'].value = document.form1.TT1.value;
                        window.close();
                    }
                }
            //-->
            </script>
        </head>
        <body>
            <form name="form1">
                <table>
                    <tr>
                        <td>
                            <input type="button" name="B1" value="提交" onclick="Win_close();">
                        </td>
                    </tr>
                    <tr>
                        <td>
                            请输入您的手机号:
                        </td>
                        <td>
                            <input type="text" name="TT1" size="20" maxlength="11">
                        </td>
                    </tr>
                </table>
            </form>
        </body>
    </html>