大家想当黑客吗,这是一个很好的资料,看看有好处的,
源代码在线查看: function.js
//用户注册客户端检测
function CheckRegForm(){
var reMail = /^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.){1,4}[a-z]{2,3}$/; //检测电子邮件正则式
var reStr = /[^0-9a-z_]/gi; //字符正则式
var reNum = /^\d{6}$/g; //数字正则式
if (RegForm.registname.value=="" || reStr.test(RegForm.registname.value) || RegForm.registname.value.length>20){
alert("请输入正确的注册帐号!");
RegForm.registname.focus();
return;
}
if (RegForm.username.value==""){
alert("请输入用户名!");
RegForm.username.focus();
return;
}
if (RegForm.userpwd.value=="" || RegForm.userpwd.value.length alert("密码不能为空,且6位以上!");
RegForm.userpwd.focus();
return;
}
if (RegForm.confirmpwd.value!=RegForm.userpwd.value){
alert("两次密码输入不一致!");
RegForm.confirmpwd.focus();
return;
}
if (RegForm.checkcode.value==""){
alert("请输入验证码!");
RegForm.checkcode.focus();
return;
}
if (RegForm.truename.value==""){
alert("请输入你的真实姓名!");
RegForm.truename.focus();
return;
}
if (RegForm.usermail.value=="" || !reMail.test(RegForm.usermail.value)){
alert("请正确输入你的电子邮件地址!");
RegForm.usermail.focus();
return;
}
/*if (RegForm.usermobile.value==""){
alert("请输入你的移动电话号码!");
RegForm.usermobile.focus();
return;
}
if (RegForm.userim.value==""){
alert("请填写您的QQ或MSN联系方式!");
RegForm.userim.focus();
return;
}
if (RegForm.useraddr.value==""){
alert("请填入你的正确联系地址!");
RegForm.useraddr.focus();
return;
}
if (RegForm.usercode.value=="" || !reNum.test(RegForm.usercode.value) || RegForm.usercode.value.length!=6){
alert("请正确输入邮政编码!");
RegForm.usercode.focus();
return;
}
if (RegForm.userprove.value=="" || (RegForm.userprove.value.length!=15 && RegForm.userprove.value.length!=18)){
alert("身份证为必填项!");
RegForm.userprove.focus();
return;
}*/
RegForm.submit();
}
//用户登录表单检测
function CheckLoginForm(usedformName){
var usedform;
eval("usedform=document.all."+usedformName+";");
if (usedform.loginuser.value==""){
alert("请输入您的用户名");
usedform.loginuser.focus();
return;
}
if (usedform.loginpwd.value==""){
alert("密码不能为空");
usedform.loginpwd.focus();
return;
}
usedform.submit();
}
//编辑推荐分类表单检测
function ChkCommendSortForm(usedform){
var reNum = /^\d/g; //数字正则式
if (usedform.CommendSortName.value==""){
alert("推荐分类名不能为空");
usedform.CommendSortName.focus();
return;
}
if (usedform.MaxNum.value=="" || !reNum.test(usedform.MaxNum.value)){
alert("请输入正确的推荐限量数");
usedform.MaxNum.focus();
return;
}
usedform.submit();
}
//编辑推荐分类书籍表单检测
function ChkCommendBookForm(usedform){
var reNum = /^\d/g; //数字正则式
if (usedform.bookid.value=="" || !reNum.test(usedform.bookid.value)){
alert("请指定正确的书籍ID");
usedform.bookid.focus();
return;
}
if (usedform.name==document.all.CommendBookForm.name && usedform.ListSort1.value==""){
alert("请指定推荐分类");
usedform.ListSort1.focus();
return;
}
usedform.submit();
}
//作者注册检测表单
function ChkAuthorRegisterForm(){
var reNum = /^\d/g; //数字
var reMail = /^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.){1,4}[a-z]{2,3}$/; //检测电子邮件正则式
var reStr = /[^0-9a-z_]/gi; //字符正则式
if (AuthorRegisterForm.authoracc.value=="" || reStr.test(AuthorRegisterForm.authoracc.value)){
alert("请正确输入帐号");
AuthorRegisterForm.authoracc.focus();
return;
}
if (AuthorRegisterForm.authorpwd.value=="" || AuthorRegisterForm.authorpwd.value.length < 6){
alert("密码必须6位或6位以上");
AuthorRegisterForm.authorpwd.focus();
return;
}
if (AuthorRegisterForm.morepwd.value=="" || AuthorRegisterForm.morepwd.value!=AuthorRegisterForm.authorpwd.value){
alert("确认密码错误填写");
AuthorRegisterForm.morepwd.focus();
return;
}
if (AuthorRegisterForm.truename.value==""){
alert("请填写你的真实姓名");
AuthorRegisterForm.truename.focus();
return;
}
if (AuthorRegisterForm.nickname.value==""){
alert("请填写呢称");
AuthorRegisterForm.nickname.focus();
return;
}
/*if (AuthorRegisterForm.authoridcard.value==""){
alert("请输入您的身份证号码");
AuthorRegisterForm.authoridcard.focus();
return;
}*/
if (AuthorRegisterForm.authormail.value=="" || !reMail.test(AuthorRegisterForm.authormail.value)){
alert("请输入正确的EMAIL");
AuthorRegisterForm.authormail.focus();
return;
}
if (AuthorRegisterForm.authorqq.value==""){
alert("请输入正确的QQ或MSN联系方式");
AuthorRegisterForm.authorqq.focus();
return;
}
if (AuthorRegisterForm.authorphone.value==""){
alert("请输入您正确的联系电话");
AuthorRegisterForm.authorphone.focus();
return;
}
AuthorRegisterForm.submit();
}
//检查客服表单
function CheckCustomerForm(){
if (CustomerForm.content.value==""){
alert("请输入咨询问题内容");
CustomerForm.content.focus();
return;
}
CustomerForm.submit();
}
//检查作者登录表单
function CheckAuthorLoginForm(usedformName){
eval("var usedform=document.all."+usedformName+";");
if (usedform.ID.value==""){
alert("请输入你的帐号");
usedform.ID.focus();
return;
}
if (usedform.password.value==""){
alert("请输入你的密码");
usedform.password.focus();
return
}
usedform.submit();
}
//作者注册头像选择
function ChangeAuthorFacePic(id){
switch(id){
case "1":
document.all.AuthorFaceArea.src = "../Images/Tpl_Spring/AuthorFace/Face_Author_1.gif"
break;
case "2":
document.all.AuthorFaceArea.src = "../Images/Tpl_Spring/AuthorFace/Face_Author_2.gif"
break;
case "3":
document.all.AuthorFaceArea.src = "../Images/Tpl_Spring/AuthorFace/Face_Author_3.gif"
break;
case "4":
document.all.AuthorFaceArea.src = "../Images/Tpl_Spring/AuthorFace/Face_Author_4.gif"
break;
case "5":
document.all.AuthorFaceArea.src = "../Images/Tpl_Spring/AuthorFace/Face_Author_5.gif"
break;
case "6":
document.all.AuthorFaceArea.src = "../Images/Tpl_Spring/AuthorFace/Face_Author_6.gif"
break;
}
}