<!DOCTYPE HTMLl>
<html>
<head>
<title>简单的结构</title>
<meta charset="utf-8">
</head>
<body>
<form method="post" action="">
账户:<input type="text" name=""/ ><br /><br />
密码:<input type="password" name="" /><br /><br />
确认:<input type="paasword2" name="" /><br /><br />
<input type="submit" value="注册" / onclick="return eg.regClick();" />
</form>
<script>
var eg = {};//声明一个对象,当做命名空间来使用
//定义一个公共函数来获取指定ID,减少代码量
eg.$ = function(id){
return document.getElementById(id);
};
eg.regCheck = function(){
var uid = eg.$("userid");
var upwd = eg.$("userpwd");
var upwd2 = eg.$("userpwd2");
if(uid.value == ''){
alert("账户不为空");
return false;
}
if(upwd.value == ''){
alert("密码不为空");
return false;
}
if(upwd.value !== upwd2.value){
alert("两次值不同!!");
return false;
}
return true;
};
</script>
</body>
</html>
慕哥6064833
慕的地6079101
等着花开花谢
慕设计2083559
YashonNice
磨砂
阳火锅
相关分类