Sat Apr 22 06:54:00 UTC 2023 inscode

上级 eefd7c09
......@@ -40,6 +40,45 @@
</div>
</div>
<script>
//要操作到的元素
let login = document.getElementById("login");
let register = document.getElementById("register");
let regSubmit = document.getElementById("reg_submit");
let form_box = document.getElementsByClassName("from-box")[0];
let register_box = document.getElementsByClassName("register-box")[0];
let login_box = document.getElementsByClassName("login-box")[0];
//点击去注册按钮点击事件
register.addEventListener('click',()=>{
form_box.style.transform='translateX(80%)';
login_box.classList.add('hidden');
register_box.classList.remove('hidden');
})
//点击去登录按钮点击事件
login.addEventListener('click',()=>{
form_box.style.transform='translateX(0%)';
register_box.classList.add('hidden');
login_box.classList.remove('hidden');
})
regSubmit.addEventListener('click',()=>{
demo();
})
function demo() {
var phoneId = document.getElementById("reg_phone");//获取输入框
var phoneNum = phoneId.value;
var regExp = new RegExp("^1[3578]\\d{9}$");
if (regExp.test(phoneNum)) {
alert("手机号正确");
} else {
alert("手机号错误");
}
}
</script>
<script type="module" src="/src/main.js"></script>
</body>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册