Coding/HTML & CSS
[HTML & CSS] 경고창(alert) 확인 / 취소 띄우기!
포스트it
2020. 10. 26. 12:09
728x90
반응형
- code -
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
function button_event(){
if (confirm("정말 삭제하시겠습니까??") == true){ //확인
var form = document.test;
form.submit();
}else{ //취소
return;
}
}
</script>
</head>
<body>
<form name="test">
<input type="text" placeholder="삭제할 게시글 번호 입력">
<input type="button" value="삭제하기" onclick="button_event()">
</form>
</body>
</html>
결과물
728x90
반응형