求哪位给发个全面点的JavaScript注册表单,不胜感激!!!!!
解决方案 »
- HTML5里面的canvas标签到底有什么好处?和div比优势在哪?
- 怎样用简单的办法,让链接实现按钮相同的效果:根据onsubmit()返回值,调用submit()?
- 如果用frame打开任意网页,可以从frame得到网页的dom树,进而操作里面的页面吗?
- 这是啥意思?
- jquery有什么控件可以装文章归档的?
- 那位高手能帮我,把这段程序改写成JavaScript的,现在是用vbs写的
- 屏蔽shift+鼠标左键!!!
- defaultSelected特性应用
- 能否用innerHTML动态改变table的行数??
- 在javascript中,俩个数相除,怎么样使它的值小数点后只有俩位?
- window.onload问题
- 图片淡入淡出的问题,请帮忙!
邮箱:[email protected]
<html>
<head>
<script language = "javascript">
function yz(){
if(Login()&&pass()&&Email()&&year()){
return true;}
else{
return false;}
}
function Login(){
//alert("111111111111");
var login = document.myform.txt.value;
if(login.length == 0){
alert("用户名不能为空");
return false;
}
if(login.length <=4 || login.length >=16){
alert("输入用户名的长度不对");
return false;
}
for(i=0;i<login.length;i++){
var as = login.substring(i,i+1);
//alert(as);
if(as < 'a'|| as >'z'){
//alert("2222222222222222");
alert("用户名必须是字母");
return false;
}
}
return true;
}
function pass(){
//alert("dsdddddddddddddddd");//alert("22222222222222");
var pwd = document.myform.txt1.value;
var passpowd = document.myform.txt2.value;
if(pwd.length == 0){
alert("密码不能为空");
return false;
}
if(pwd.length <6 || pwd.length >16){
alert("输入密码的长度不对");
return false;
}
if(!(pwd == passpowd)){
alert("两次密码输入不一致");
return false;
}
return true;
}
function Email(){
var email = document.myform.email.value;
var email1 = email.indexOf("@",0);
//alert(email1);
var email2 = email.indexOf(".",0);
//alert(email2);
if(email.length == 0){
alert("电子邮件不能为空");
return false;
}
if(email.indexOf("@",0) == -1){
alert("电子邮件必须包含@");
return false;
}
if(email.indexOf(".",0) == -1){
alert("电子邮件必须包含.");
return false;
}
if(email1 > email2){
alert(".必须在@之后");
return false;
}
return true;
}
function year(){
var yy = document.myform.year.value;
if(yy.length == 0){
alert("年龄不能为空");
return false;
}
if(yy < 1900 || yy > 2012){
alert("输入的年份不正确");
return false;
}
return true;
}
</script>
</head>
<body>
<form name = "myform" method = "post" action = "1.html" onSubmit = " return yz()">
<table>
<tr>
<td>
用户名:<input type = "text" name = "txt">
</td>
</tr>
<tr>
<td>
密 码:<input type = "text" name = "txt1">
</td>
</tr>
<tr>
<td>
确认密码:<input type = "text" name = "txt2">
</td>
</tr>
<tr>
<td>
性别:<input type = "radio" name = "boy">男<input type = "radio" name = "girl">女
</td>
</tr>
<tr>
<td>
电子邮件:<input type = "text" name = "email">
</td>
</tr>
<tr>
<td>
出生日期:<input type = "text" name = "year"style ="width:100px">年
</td>
<td>
<select>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select>月
</td>
<td>
<select>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select>日
</td>
</tr>
<tr>
<td><input type = "submit" name = "tijiao" value = " 提 交 "></td>
</tr>
</table>
</form>
</body>
</html>