在用户控件中用户登录后台脚本判断

在用户控件中用户登录后台脚本判断写法

 if (!IsPostBack)
        {
           
            imagelogin.Attributes.Add(
"onclick""javascript:if(document.getElementById('" + user_name.ClientID.ToString() + "').value==''){alert('用户名不能为空');document.getElementById('" + user_name.ClientID.ToString() + "').focus();return false;} if(document.getElementById('" + user_pwd.ClientID.ToString() + "').value==''){alert('用户密码不能为空');document.getElementById('" + user_pwd.ClientID.ToString() + "').focus();return false;} if(document.getElementById('" + user_valid.ClientID.ToString() + "').value==''){alert('验证码不能为空');document.getElementById('" + user_valid.ClientID.ToString() + "').focus();return false;};");

}
原文地址:https://www.cnblogs.com/sendling/p/1365680.html