添加期末大作业文件夹Project,目前与Assignment5中一致
This commit is contained in:
51
Project/static/js/checkInfo.js
Normal file
51
Project/static/js/checkInfo.js
Normal file
@@ -0,0 +1,51 @@
|
||||
var checkInfo = {}
|
||||
|
||||
checkInfo.checkCardCode = function() {
|
||||
let cardCode = document.getElementById('cardCode').value
|
||||
let regexCardCode = /^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
|
||||
if(!regexCardCode.test(cardCode)) {
|
||||
alert('身份证号格式有误')
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
checkInfo.checkMobileNo = function() {
|
||||
let mobileNo = document.getElementById('mobileNo').value
|
||||
let regexMobileNo = /^1[3-9]\d{9}$/
|
||||
if (!regexMobileNo.test(mobileNo)) {
|
||||
alert('手机号格式有误')
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
checkInfo.checkPassword = function() {
|
||||
let password = document.getElementById('password')
|
||||
let regexPassword = /^[A-Za-z0-9\W_]{6,20}$/
|
||||
if (!regexPassword.test(password.value)) {
|
||||
alert("密码须为长度为6-20位字母、数字或符号")
|
||||
return false
|
||||
}
|
||||
let confirmPassword = document.getElementById('confirmPassword')
|
||||
if (password.value !== confirmPassword.value) {
|
||||
alert("两次输入的密码不一致")
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
checkInfo.checkNewPassword = function() {
|
||||
let password = document.getElementById('newPassword')
|
||||
let regexPassword = /^[A-Za-z0-9\W_]{6,20}$/
|
||||
if (!regexPassword.test(password.value)) {
|
||||
alert("密码须为长度为6-20位字母、数字或符号")
|
||||
return false
|
||||
}
|
||||
let confirmPassword = document.getElementById('confirmNewPassword')
|
||||
if (password.value !== confirmPassword.value) {
|
||||
alert("两次输入的密码不一致")
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
Reference in New Issue
Block a user