添加期末大作业文件夹Project,目前与Assignment5中一致

This commit is contained in:
typingbugs
2024-05-26 21:49:58 +08:00
parent 53d8334ba3
commit 8dd5a17062
12 changed files with 542 additions and 0 deletions

View 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
}