js检查form中各类型的input内容不能为空

2024-11-18 17:19:48
推荐回答(1个)
回答1:

var userID = Trim(document.getElementById("UserID").value);
if (userID.length == 0) {
alert("请输入登录用户帐号!");
document.getElementById("UserID").focus();
return;
}
var Pwd = Trim(document.getElementById("Password").value);
if (Pwd.length == 0) {
alert("请输入帐号密码!");
document.getElementById("Password").focus();
return;
}







  • ID="Password" TextMode="Password" runat="server" onkeydown="PasswordKeyDown(event); " />