你的button的type="submit"还是type="button" ?

解决方案 »

  1.   

    代码太少,无法解释!不过这样可以,L@_@K <body>
     <form id="form1">
        <input type="text" id="TextBox1" />
     </form>
      
    <script type="text/javascript">
    <!--
    var values = "1,2";
    var hdnObj = document.forms(0).TextBox1;
    hdnObj.value = values;
    //-->
    </script>
     </body>
      

  2.   

    .net前台代码:
    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
    <INPUT id="TextBox1" type="text">
    <asp:button id="Button1" runat="server" Text="Button"></asp:button>
    </form>
    <script language="javascript">  
    function FindCheckBox()
    {
    var values = "1,2";
    var hdnObj = document.Form1.TextBox1;
    hdnObj.value = values;
    }
    </script>
    </body>该代码生成的源代码:<body MS_POSITIONING="GridLayout">
    <form name="Form1" method="post" action="WebForm1.aspx" id="Form1">
    <INPUT id="TextBox1" type="text">
    <input type="submit" name="Button1" value="Button" id="Button1" onclick="FindCheckBox()" />
    </form>
    <script language="javascript">  
    function FindCheckBox()
    {
    var values = "1,2";//选中CheckBox的值组合
    var hdnObj = document.Form1.TextBox1;
    hdnObj.value = values;
    }
    </script>
    </body>
      

  3.   

    //你的button的type="submit"还是type="button" ?<input type="submit" name="Button1" value="Button" id="Button1" onclick="FindCheckBox()" />
    ----------》
    <input type="button" name="Button1" value="Button" id="Button1" onclick="FindCheckBox()" />
      

  4.   

    [size=16px][b]两口矿井年[/size][/b]