LinkButton belongs to a label, you must obtain the focus before you can use $ ("#<%=this.lbtnlogin.clientid%>"). Click ();
WORKAROUND: Direct trigger LinkButton postback event javascript: __doPostBack (' Lbtnlogin ', ');
<asp:textbox id= "txtloginname" cssclass= "TXT" runat= "server" tabindex= "1" placeholder= "username" ></asp:textbox >
<asp:textbox id= "txtpassword" cssclass= "TXT" textmode= "Password" runat= "Server" tabindex= "2"
placeholder= "Password" ></asp:TextBox>
<asp:linkbutton id= "Lbtnlogin" validationgroup= "Login" runat= " Server "width=" 173 "height="
onclientclick= "return valid ()" onclick= "Lbtnlogin_click" > Login </asp: Linkbutton>
<script type= "Text/javascript" > function valid () {var loginname = $ ("#<%=this.txtloginname.c
Lientid%> "). Val (). Replace (" username "," ");
var Loginpassword = $ ("#<%=this.txtpassword.clientid%>"). Val (). replace ("password", ""); if (LoginName = = "" | | Loginpassword = = "") {if (LoginName = = "" && Loginpassword = "") {$ ("#<% =this.validmessage.clientid%> "). Text (" Enter your username and password. ")
");
$ ("#<%=this.txtloginname.clientid%>"). focus (); else if (LoginName = "") {$ ("#<%=this.validmessage.clientid%>"). Text ("Please fill in the username.")
"); $ ("#<%=this.validmessage.clientid%>"). Text ("Please enter a username and password.)
"); else {$ ("#<%=this.validmessage.clientid%>"). Text ("Enter your password.
");
$ ("#<%=this.txtpassword.clientid%>"). focus (); } $ ("#<%=this.validsuMmary.
ClientID%> "). Show ();
return false;
else {return true; } $ (function () {$ ("#<%=this.txtloginname.clientid%>"). KeyUp (function (event) {//select already Account password Login return event for KeyDown, prevent event conflict, commit login using KeyUp event var e = Events | | window.event | |
Arguments.callee.caller.arguments[0]; if (e && e.keycode = 13) {//Login box, carriage return event var Loginpassword = $ ("#<%=this.txtpassword.clientid
%> "). Val (). replace (" password "," "); if (Loginpassword = = "") {$ ("#<%=this.txtpassword.clientid%>"). focus ();/Enter, the detection password is not filled, then fixed to the password
box return;
} if (valid ()) {//form validation passed, submit login javascript: __dopostback (' Lbtnlogin ', ');
LinkButton belongs to a label, you must obtain the focus before you can use $ ("#<%=this.lbtnlogin.clientid%>"). Click (); Solution: Direct Triggering LinKbutton the postback Event  }});
$ ("#<%=this.txtpassword.clientid%>"). KeyUp (function (event) {//Select Existing account password login return event is KeyDown, prevent event conflict, commit login use KeyUp event var e = Event | | window.event | |
Arguments.callee.caller.arguments[0]; if (e && e.keycode = 13) {//Password box, carriage return event if (valid ()) {//form validation through Javascrip
T: __doPostBack (' Lbtnlogin ', ');//Commit login}}});
}); </script>