<asp:Button ID="button" runat="server" OnClientClick="return CheckCodeInsert();" 
                                  Text="我已阅读以下条款并同意注册" Width="240px" />
function testClick() {
    document.getElementById("button").click();}
  有人说用这种方法,但是根本不好使啊,就没有click()这个方法好像 还有   function CheckCodeInsert() {
            var code = $("#checkcode").val();
            $.ajax({
                url: "Ajax/CheckCodeInsert.aspx?Code=" + code,
                type: "GET",
                timeout: 30000,
                success: function(data) {
                    if (data == "1") {
                        //                $.ajax({ 
                        //                  url 
                        //                    url: "/Ajax/CheckCodeInsert.aspx?Code=" + code,
                        //                }); ---------重点                       <%=xx无返回值的方法名()%>
                        return true;
                    }
                    else {
                        alert("验证码错误");
                        return false;
                    }
                }
            });        }
就是上面想执行一个后页的,无返回值的方法,应该怎么做呢?

解决方案 »

  1.   


    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title></title>
        <script type="text/javascript">
            function test() {
                var a = document.getElementById("<%=Button1.ClientID%>");
                //debugger;
                alert(a.outerHTML);
            }
        
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:Button ID="Button1" runat="server" Text="我已阅读以下条款并同意注册" OnClientClick="test();" />
        </div>
        </form>
    </body>
    </html>