Chinaunix

标题: 为什么不行呢 [打印本页]

作者: wan8832    时间: 2008-12-09 18:25
标题: 为什么不行呢
<script Language="JavaScript">
function FormCheck(theform)
{

if (theform.user.value =="")
{
alert("请填写您的用户名!");
theform.user.focus();
return false;
}
var filter=/^\\s*[.A-Za-z0-9_-]{5,15}\\s*$/;
if (!filter.exec(theform.user.value)) {
alert("用户名填写不正确,请重新填写!可使用的字符为(A-Z a-z 0-9 _ - .)长度不小于5个字符,不超过15个字符,注意不要使用空格。");
theform.user.focus();
theform.user.select();
return false;
}
if (theform.pass.value =="")
{
alert("请填写您的密码!");
theform.pass.focus();
return false;
}
if(theform.confirmPassword.value==""){
alert("请输入您的确认密码!");
theform.confirmPassword.focus();
return false;
}
var filter=/^\\s*[.A-Za-z0-9_-]{5,15}\\s*$/;
if (!filter.exec(theform.pass.value)) {
alert("密码填写不正确,请重新填写!可使用的字符为(A-Z a-z 0-9 _ - .)长度不小于5个字符,不超过15个字符,注意不要使用空格。");
theform.pass.focus();
theform.pass.select();
return false;
}
if (theform.pass.value!=theform.confirmPassword.value ){
alert("两次填写的密码不一致,请重新填写!");
theform.pass.focus();
theform.pass.select();
return false;
}

if (theform.email.value =="")
{
alert("请输入您的电子邮件地址!");
theform.email.focus();
theform.email.select();
return false;
}
var filter=@;
if (!filter.test(theform.email.value)) {
alert("邮件地址不正确,请重新填写!");
theform.email.focus();
theform.email.select();
return false;
}
<!-- theform.submit() -->
}
</script>
<body>

<form name="theform" method="post" action="" onsubmit="return FormCheck(this);">
<table width="59%"  border="0" cellspacing="4" cellpadding="0">
&nbsp;&nbsp;<tr>
&nbsp;&nbsp;&nbsp;&nbsp;<td width="38%" class="text2"><div align="right">用户名:</div></td>
&nbsp;&nbsp;&nbsp;&nbsp;<td width="62%"><div align="left">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="user">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="text2">英文和数字结合</span></div></td>
&nbsp;&nbsp;</tr>
&nbsp;&nbsp;<tr>
&nbsp;&nbsp;&nbsp;&nbsp;<td class="text2"><div align="right">密码:</div></td>
&nbsp;&nbsp;&nbsp;&nbsp;<td><div align="left">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="pass">
&nbsp;&nbsp;&nbsp;&nbsp;</div></td>
&nbsp;&nbsp;</tr>
&nbsp;&nbsp;<tr>
&nbsp;&nbsp;&nbsp;&nbsp;<td class="text2"><div align="right">密码确认:</div></td>
&nbsp;&nbsp;&nbsp;&nbsp;<td><div align="left">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="confirmPassword">
&nbsp;&nbsp;&nbsp;&nbsp;</div></td>
&nbsp;&nbsp;</tr>
&nbsp;&nbsp;<tr>
&nbsp;&nbsp;&nbsp;&nbsp;<td class="text2"><div align="right">邮箱地址:</div></td>
&nbsp;&nbsp;&nbsp;&nbsp;<td><div align="left">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="email">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="text">*用于密码忘记时取回!</span></div></td>
&nbsp;&nbsp;</tr>
&nbsp;&nbsp;<tr>
&nbsp;&nbsp;&nbsp;&nbsp;<td colspan="2"><div align="center">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="Submit" value="注册" >
&nbsp;&nbsp;&nbsp;&nbsp;</div></td>
&nbsp;&nbsp;</tr>
</table>
</form>





欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2