diff --git a/web/index.html b/web/index.html index 0b9d163..0068287 100644 --- a/web/index.html +++ b/web/index.html @@ -76,6 +76,13 @@
or
- + + + +
+
+ +
+ \ No newline at end of file diff --git a/web/menu.js b/web/menu.js index e3c4f5b..ae93158 100644 --- a/web/menu.js +++ b/web/menu.js @@ -45,11 +45,15 @@ firstStep.addEventListener('click',() => { displayCharacter() }); var roomNum = document.querySelector('#roomNum'); var roomBtn = document.querySelector('#roomBtn'); roomBtn.addEventListener('click',() => { - if(roomNum.value != null && 0 <= parseInt(roomNum.value) && 99999 >= parseInt(roomNum.value)){ + var regex = new RegExp('^[0-9]{1,5}$'); + if(roomNum.value != null && regex.test(roomNum.value)){ roomID = roomNum.value; setter(); location.href = './cards.html'; } else { + ts('.snackbar').snackbar({ + content: '請輸入正確的房號!', + }); console.log("room number error"); } });