📄 reg.jsp
字号:
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<script language="javascript" type="text/javascript" >
function showmore() {
if (document.forms[0].more.checked==true) {
moretable.style.display = "";
flag.innerText="关闭高级选项"
}else{
moretable.style.display = "none";
flag.innerText="打开高级选项";
}
}
function CheckForm(){
var iu, iuu, regArray=new Array("","???","???","???","???","???","???","???"+
"!","@","#","$","%","^","&","*","(",")","-","+","=","|","'","[","]","???","~","`"+
"!","<",">","???","???","???","???","???","??","??");
iuu=regArray.length;
for(iu=1;iu<=iuu;iu++){
if (document.forms[0].username.value.indexOf(regArray[iu])!=-1){
alert("用户名不能够包含字符:" + regArray[iu]);
document.forms[0].username.focus();
return false;
}
}
if (document.forms[0].username.value.length==0) {
alert("用户名不能够为空.");
document.forms[0].username.focus();
return false;
}
if (document.forms[0].username.value.length>12) {
alert("用户名长度不大于12个字符.");
document.forms[0].username.focus();
return false;
}
if (document.forms[0].username.value.indexOf(" ")!=-1){
alert("用户名不能够包含空格");
document.forms[0].username.focus();
return false;
}
if (document.forms[0].code.value.length<4) {
alert("请填写验证码.");
document.forms[0].code.focus();
return false;
}
if (document.forms[0].password1.value.length==0) {
alert("密码长度不能够为零");
document.forms[0].password1.focus();
return false;
}
if (document.forms[0].password1.value.length<6) {
alert("密码长度不应该小于6.");
document.forms[0].password1.focus();
return false;
}
if (document.forms[0].password2.value.length==0) {
alert("确认密码长度不能够等于零");
document.forms[0].password2.focus();
return false;
}
if (document.forms[0].password1.value != document.forms[0].password2.value) {
alert("两次密码不一致.");
document.forms[0].password1.focus();
return false;
}
if (document.forms[0].email.value.length==0) {
alert("E_mail长度不能够等于零.");
document.forms[0].email.focus();
return false;
}
if (document.forms[0].email.value.length>0 && !document.forms[0].email.value.match(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) ) {
alert("请填写正确的E_mail地址");
document.forms[0].email.focus();
return false;
}
if (document.forms[0].introdution.value.length>200) {
alert("自我介绍长度不能够大于200.");
document.forms[0].introdution.focus();
return false;
}
if (document.forms[0].signature.value.length>200) {
alert("签名内容长度不能够大于200.");
document.forms[0].signature.focus();
return false;
}
return true;
}
function showimage() {
document.forms[0].bbsimages.src="webapp/images/avatars/"+ document.forms[0].imageselect.options[document.forms[0].imageselect.selectedIndex].value;
}
function imgselect(){
if (document.forms[0].image[0].checked==true) {
document.images.bbsimages.style.display ="";
document.forms[0].imageselect.disabled=false;
if(document.forms[0].imgupload==null) {
document.forms[0].imgw.disabled=true;
document.forms[0].imgh.disabled=true;
document.forms[0].imgw.disabled=true;
document.forms[0].imgurl.disabled=true;
}else {
document.forms[0].imgupload.disabled=true;
document.forms[0].imgw.disabled=true;
document.forms[0].imgh.disabled=true;
document.forms[0].imgurl.disabled=true;
}
}else if (document.forms[0].image[1].checked==true) {
document.images.bbsimages.style.display ="none";
document.forms[0].imageselect.disabled=true;
document.forms[0].imgupload.disabled=false;
document.forms[0].imgw.disabled=false;
document.forms[0].imgh.disabled=false;
document.forms[0].imgurl.disabled=false;
}
}
imgselect();
//check password
function CharMode(iN){
if (iN>=48 && iN <=57) //数字
return 1;
if (iN>=65 && iN <=90) //大写字母
return 2;
if (iN>=97 && iN <=122) //小写
return 4;
else
return 8; //特殊字符
}
//bitTotal函数
//计算出当前密码当中一共有多少种模式
function bitTotal(num){
modes=0;
for (i=0;i<4;i++){
if (num & 1) modes++;
num>>>=1;
}
return modes;
}
//checkStrong函数
//返回密码的强度级别
function checkStrong(sPW){
if (sPW.length<=4)
return 0; //密码太短
Modes=0;
for (i=0;i<sPW.length;i++){
//测试每一个字符的类别并统计一共有多少种模式.
Modes|=CharMode(sPW.charCodeAt(i));
}
return bitTotal(Modes);
}
//pwStrength函数
//当用户放开键盘或密码输入框失去焦点时,根据不同的级别显示不同的颜色
function pwStrength(pwd){
O_color="#eeeeee";
L_color="#FF0000";
M_color="#FF9900";
H_color="#33CC00";
if (pwd==null||pwd==''){
Lcolor=Mcolor=Hcolor=O_color;
}
else{
S_level=checkStrong(pwd);
switch(S_level) {
case 0:
Lcolor=Mcolor=Hcolor=O_color;
case 1:
Lcolor=L_color;
Mcolor=Hcolor=O_color;
break;
case 2:
Lcolor=Mcolor=M_color;
Hcolor=O_color;
break;
default:
Lcolor=Mcolor=Hcolor=H_color;
}
}
document.getElementById("strength_L").style.background=Lcolor;
document.getElementById("strength_M").style.background=Mcolor;
document.getElementById("strength_H").style.background=Hcolor;
return;
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -