room number logic improvement
This commit is contained in:
parent
57709777e6
commit
9fb342146c
@ -76,6 +76,13 @@
|
|||||||
<div class="ts horizontal divider">or</div>
|
<div class="ts horizontal divider">or</div>
|
||||||
<button id="random" class="ts primary button">隨機配對</button>
|
<button id="random" class="ts primary button">隨機配對</button>
|
||||||
</div>
|
</div>
|
||||||
<script src="./menu.js"></script>
|
</div>
|
||||||
|
<!-- Anchor -->
|
||||||
|
<!-- snackbar -->
|
||||||
|
<div class="ts bottom right snackbar">
|
||||||
|
<div class="content"></div>
|
||||||
|
<a class="action"></a>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
<script src="./menu.js"></script>
|
||||||
</html>
|
</html>
|
@ -45,11 +45,15 @@ firstStep.addEventListener('click',() => { displayCharacter() });
|
|||||||
var roomNum = document.querySelector('#roomNum');
|
var roomNum = document.querySelector('#roomNum');
|
||||||
var roomBtn = document.querySelector('#roomBtn');
|
var roomBtn = document.querySelector('#roomBtn');
|
||||||
roomBtn.addEventListener('click',() => {
|
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;
|
roomID = roomNum.value;
|
||||||
setter();
|
setter();
|
||||||
location.href = './cards.html';
|
location.href = './cards.html';
|
||||||
} else {
|
} else {
|
||||||
|
ts('.snackbar').snackbar({
|
||||||
|
content: '請輸入正確的房號!',
|
||||||
|
});
|
||||||
console.log("room number error");
|
console.log("room number error");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user