const userinfo = () => {
// Trim -- remove spaces
username = document.getElementById("username").value.trim();
email = document.getElementById("email").value.trim();
password = document.getElementById("password").value.trim();
confirmpassword = document.getElementById("confirmpassword").value.trim();
console.log(username, email, password, confirmpassword);
};
const checkinput = () => {
// Not Null
if (
username.trim().length !== 0 &&
email.trim().length !== 0 &&
password.trim().length !== 0 &&
confirmpassword.trim().length !== 0
) {
return true;
} else {
// Style Java
// Element.style.typeof style(Border, Size, Font, Color)
msgPassword.style.border = "2px solid red";
msgConfirm.style.border = "2px solid red";
document.getElementById("error-allength").innerHTML =
"place fill all filed ";
return false;
}
};
我希望这个条件能够用于填写验证表单的输入,我认为这是不可能解决的问题,请帮帮我!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
const checkinput = () => { if ( username.trim().length !== 0 || email.trim().length !== 0 || password.trim().length !== 0 || confirmpassword.trim().length !== 0 ) { return true; } else { msgPassword.style.border = "2px solid red"; msgConfirm.style.border = "2px solid red"; document.getElementById("error-allength").innerHTML = "请填写所有字段"; return false; } };