添加期末大作业文件夹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,9 @@
/* h1, ul, li, a, body {
margin: 0;
padding: 0;
text-decoration: none;
} */
li {
list-style: none;
}

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
}

View File

@@ -0,0 +1,28 @@
var modify = {}
modify.showModifyPassword = function() {
let modifyType = document.getElementById('modifyType').value
let info = {
modifyPasswordLis: document.getElementsByClassName('modifyPassword'),
modifymobileNoLis: document.getElementsByClassName('modifymobileNo'),
}
// 遍历隐藏所有元素
for (let key in info) {
let elements = info[key];
for (let item of elements) {
item.style.display = 'none'; // 确保所有相关元素被隐藏
}
}
// 根据 modifyType 显示相关元素
if (modifyType === "2") {
for (let item of info.modifyPasswordLis) {
item.style.display = 'block';
}
} else if (modifyType === "3") {
for (let item of info.modifymobileNoLis) {
item.style.display = 'block';
}
}
}