jquery.trigger(“click”)在谷歌浏览器中被调用两次

时间:2013-08-21 12:04:58

标签: c# javascript

代码:

 $(window).keypress(function (e) {
        if (e.which == 13 || e.KeyCode == 13 || e.charCode == 13) { $("#<%=Send_btn.ClientID %>").trigger("click"); }
    });

    <asp:Button ID="Send_btn" runat="server" Text="Send" OnClick="Send_msg_Click"></asp:Button>

C#:

 protected void Send_msg_Click(object sender, EventArgs e)
{ 
     int ToClient = int.Parse(Request["frid"].ToString());
     int FromClient = int.Parse(Request["uid"].ToString());
     SendChatMessage(Message_txt.Text, ToClient, false);
     ConversationDIv.InnerHtml = GetChat(ToClient, FromClient, Session["history"].ToString());
     Message_txt.Focus();
     Message_txt.Text = "";
     var sc = "ScrollCoversationDiv('" + ToClient + "')";
     ScriptManager.RegisterStartupScript(this, GetType(), "MyScript", sc, true);
}

当我点击进入时,在谷歌浏览器中调用两次Send_msg_click为什么?

0 个答案:

没有答案