Created
December 3, 2021 06:33
-
-
Save aaei924/905d3795bc4fad6cfa6bab02d52c51a3 to your computer and use it in GitHub Desktop.
서현제 부스 내 인원 관리 페이지
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<meta charset="UTF-8"> | |
<style> | |
*{ | |
text-align:center; | |
vertical-align:center; | |
} | |
button { | |
font-size: 24pt; | |
} | |
h1 { | |
font-size: 64pt; | |
} | |
</style> | |
<h3> 현재 인원 수 </h3><br><br> | |
<h1 id="man"> 0 </h1><br> | |
<h4>출입 가능 인원 수: <span id="av">15</span>/15</h4> | |
<button type="button" id="increase"> 들어옴 </button> | |
<button type="button" id="decrease"> 나감 </button> | |
<script> | |
p = 0 | |
a = 15 | |
i = document.getElementById('increase') | |
d = document.getElementById('decrease') | |
m = document.getElementById('man') | |
v = document.getElementById('av') | |
if(i&&d){ | |
i.addEventListener('click', () => { | |
++p | |
--a | |
m.innerText = p | |
v.innerText = a | |
}) | |
d.addEventListener('click', () => { | |
if(p > 0){ | |
--p | |
} | |
++a | |
m.innerText = p | |
v.innerText = a | |
}) | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment