OnClientClick方法真乃神器,客户端方法,和服务器端的onclick时间不冲突。

<asp:Button ID="btnLogin" runat="server" Text="登录" Height="26px" onclick="btnLogin_Click" OnClientClick="return Check()" Width="68px" />
function Check() {
             var name = document.getElementById("txt_user_num").value;
             var pwd = document.getElementById("txt_user_pwd").value;
             var code = document.getElementById("tbcode").value;
             if (name == "" || pwd == "" || code == "") {
                 document.getElementById("txt_user_num").style.backgroundColor = "Red"
                 return false;
             }else{ 
                return true
             }

相关文章:

  • 2021-12-04
  • 2021-08-30
  • 2021-09-30
  • 2022-12-23
  • 2022-12-23
  • 2021-11-09
  • 2022-01-06
猜你喜欢
  • 2021-06-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-25
  • 2022-02-01
相关资源
相似解决方案