// TODO: const testError = document.getElementById('test-error'); const username = document.getElementById('username'); let regexp = /[0-9A-Za-z]{3,10}/; if (!regexp.test(username.value)) { testError.innerText = '用户名必须是3-10位英文字母或数字'; return false; } const password = document.getElementById('password'); regexp = /[\d\w]{6,20}/; if (!regexp.test(password.value)) { testError.innerText = '口令必须是6-20位'; return false; } const password2 = document.getElementById('password-2'); if (password.value !== password2.value) { testError.innerText = '两次输入口令必须一致'; return false; } testError.innerText = ''; return true; }
Sign in to make a reply
流