Javascript를 이용한 Confirm Dialog를 띄우는 방법입니다.
HTML 소스
<body> <button id="button">confirm</button> <h5 id="text">취소</h5> </body>
Javascript 소스
<script type="text/javascript"> document.getElementById("button").onclick = function() { var bool = confirm("yes or no"); var text = document.getElementById("text"); if (bool) { text.innerHTML = "확인"; } else { text.innerHTML = "취소"; } } </script>
결과
소스 및 예제페이지 확인
'Web' 카테고리의 다른 글
[Javascript/jQuery]버튼 클릭, 더블클릭 이벤트 (0) | 2018.09.06 |
---|---|
[Javascript/jQuery]Table 특수키(Ctrl, Shift)를 이용한 다중선택 (0) | 2018.09.04 |