中华网BLOG注册页面检查代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Language" content="zh-CN" />
<title>中华网博客---注册</title>
<script>
function checkEmail (str) {
//alert(str);
isEmail1=/^\w+([\.\-]\w+)*\@\w+([\.\-]\w+)*\.\w+$/;
isEmail2=/^.*@[^_]*$/;
//alert(isEmail1.test(str)&&isEmail2.test(str));
return (isEmail1.test(str)&&isEmail2.test(str));
}
function IsDigit(cCheck)
{
return (('0'<=cCheck) && (cCheck<='9'));
}
function IsAlpha(cCheck)
{
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
}
function IsaNull(cCheck)
{
return(cCheck != " ")
}
function checkform(){
//alert(document.bloguserForm.username.value);
if (document.bloguserForm.username.value == ""){
alert("请输入注册名");
document.bloguserForm.username.focus();
return false;
}
if(document.bloguserForm.username.value.length>20 || document.bloguserForm.username.value.length<6){
alert("用户名为6到12个字母或数字");
document.bloguserForm.username.focus();
return false;
}
for (nIndex=0; nIndex<document.bloguserForm.username.value.length; nIndex++){
cCheck = document.bloguserForm.username.value.charAt(nIndex);
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')){
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
document.bloguserForm.username.focus();
return false;
}
}
if (document.bloguserForm.password.value == ""){
alert("请输入注册密码");
document.bloguserForm.password.focus();
return false;
}
if(document.bloguserForm.password.value.length < 6 || document.bloguserForm.password.length >20){
alert("密码长度在6--12位之间!");
document.bloguserForm.password.focus();
return false;
}
if(document.bloguserForm.password.value!=document.bloguserForm.password1.value){
alert("密码不匹配!");
document.bloguserForm.password.focus();
return false;
}
if(document.bloguserForm.question.value == ""){
alert("请输入密码问题!");
document.bloguserForm.question.focus();
return false;
}
if(document.bloguserForm.answer.value == ""){
alert("请输入密码回答!");
document.bloguserForm.answer.focus();
return false;
}
if(!checkEmail(document.bloguserForm.mailbox.value)){
alert('邮箱地址错误!');
document.bloguserForm.mailbox.focus();
return false;
}
if(!checkEmail(document.bloguserForm.mailbox.value)){
alert('邮箱地址错误!');
document.bloguserForm.mailbox.focus();
return false;
}
document.bloguserForm.submit();
return true;
}
</script>
<link href="/form/css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<br />
<table width="90%" border="0" cellpadding="0" cellspacing="0" align="center">
<tr><td>
</td></tr>
<tr>
<td height="31"><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="35" height="30"><img src="/form/images/icon_greenball.jpg" width="23" height="21" /></td>
<td class="tit_blue18">填写注册资料</td>
</tr>
</table></td>
</tr>
<tr>
<td height="3" background="/form/images/bg_line.gif"></td>
</tr>
<tr>
<td height="8"></td>
</tr>
</table>
<table width="90%" border="0" cellpadding="0" cellspacing="0" background="/form/images/bor_fillet05.gif" align="center">
<tr>
<td><img src="/form/images/bor_fillet01.gif" width="6" height="6" /></td>
<td><img name="" src="" width="1" height="1" alt="" /></td>
<td align="right"><img src="/form/images/bor_fillet02.gif" width="6" height="6" /></td>
</tr>
</table>
<table width="90%" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td width="6" background="/form/images/bor_fillet06.gif"><img name="" src="" width="1" height="1" alt="" /></td>
<td><table width="95%" border="0" align="center" cellpadding="5" cellspacing="0" class="bor_btm txt_black">
<form name="bloguserForm" method="post" action="/bloguser.do">
<tr>
<td width="3%"><img src="/form/images/icon_arrow.gif" width="9" height="9" /></td>
<td width="13%">注册用户名:
</td>
<td width="27%"><input type="text" name="username" value=""></td>
<td width="57%"><span class="txt_red">*用户名为6-12个字母或数字</span></td>
</tr>
<tr>
<td><img src="/form/images/icon_arrow.gif" width="9" height="9" /></td>
<td>注册用密码:</td>
<td><input type="password" name="password" value=""></td>
<td><span class="txt_red">密码为6-12个字母,密码区分大小写</span></td>
</tr>
<tr>
<td><img src="/form/images/icon_arrow.gif" width="9" height="9" /></td>
<td>确认密码:</td>
<td><input type="password" name="password1" value=""></td>
<td><span class="txt_red">*</span> </td>
</tr>
<tr>
<td><img src="/form/images/icon_arrow.gif" width="9" height="9" /></td>
<td>密码问题:</td>
<td><input type="text" name="question" value=""></td>
<td><span class="txt_red">*</span> </td>
</tr>
<tr>
<td><img src="/form/images/icon_arrow.gif" width="9" height="9" /></td>
<td>密码回答:</td>
<td> <input type="text" name="answer" value=""></td>
<td><span class="txt_red">*</span> </td>
</tr>
<tr>
<td><img src="/form/images/icon_arrow.gif" width="9" height="9" /></td>
<td>Email地址:</td>
<td><input type="text" name="mailbox" value=""></td>
<td><span class="txt_red">*</span> </td>
</tr>
<tr>
<td colspan="4" align="center">
<input type="image" name="imageField" src="/form/images/btn_submit.gif" onclick="return checkform();">
</td>
</tr>
</form>
</table>
</td>
<td width="6" background="/form/images/bor_fillet07.gif"><img name="" src="" width="1" height="1" alt="" /></td>
</tr>
</table>
<table width="90%" border="0" cellpadding="0" cellspacing="0" background="/form/images/bor_fillet08.gif" align="center">
<tr>
<td><img src="/form/images/bor_fillet03.gif" width="6" height="6" /></td>
<td><img name="" src="" width="1" height="1" alt="" /></td>
<td align="right"><img src="/form/images/bor_fillet04.gif" width="6" height="6" /></td>
</tr>
</table>
</body>
</html>
posted on 2005-09-29 16:19
wf 阅读(4591)
评论(2) 编辑 收藏 引用 所属分类:
Published