密码验证

<!DOCTYPE html>

<html>
<head>
<meta charset="utf-8" />
<title></title>
<script>
window.onload=function(){
function $(id){
return document.getElementById(id);
}
$("btn").onclick=function(){
if($("txt").value==123456&&$("txt1").value==123456789){
alert("登陆成功");
}else{
alert("登陆失败");
}

}


}
</script>
</head>
<body>
<input type="text" id="txt" value="请输入账号" />
<input type="password" id="txt1" value="请输入密码" />
<button id="btn">登陆</button>


</body>
</html>

原文地址:https://www.cnblogs.com/Huanghaihui/p/6007525.html