//qq的
checkInput(my$("qq"),/^\d{5,11}$/);
//手机
checkInput(my$("phone"),/^\d{11}$/);
//邮箱
checkInput(my$("e-mail"),/^[0-9a-zA-Z_.-]+[@][0-9a-zA-Z_.-]+([.][a-zA-Z]+){1,2}$/);
//座机号码
checkInput(my$("telephone"),/^\d{3,4}[-]\d{7,8}$/);
//中文名字
checkInput(my$("fullName"),/^[\u4e00-\u9fa5]{2,6}$/);
cheackInput(my$("qq"),/^\d{5,10}$/);
cheackInput(my$("phone"),/^[1-9]{11}$/);
cheackInput(my$("e-mail"),/^[0-9a-zA-Z_.-]+[@][0-9a-zA-Z_.-]+([.][a-zA-Z]+){1,2}$/);
cheackInput(my$("fullName"),/^[\u4e00\u9fa5]{2,6}$/);
function checkInput(input,reg) {
input.οnkeyup=function () {//文本框注册失去焦点的事件
if(reg.test(this.value)){//验证文本框里的内容是否匹配
this.nextElementSibling.innerHTML="太好了,输入正确";
this.nextElementSibling.style.color="green";
}else {
this.nextElementSibling.innerHTML="警告!!!输入错误";
this.nextElementSibling.style.color="red";
}
};
}