일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- html css
- JS
- 웹
- 홈페이지젲가
- 요양원홈페이지제작
- html 수정
- web
- 게시판만들기
- 홈페이지제작
- 포유스타
- input태그
- 언어별따로
- js수정
- 컴퓨터공학과
- 퍼블리셔공부
- 홈페이지수정
- HTML
- CSS
- css수정
- php
- 복지관홈페이지제작
- 프론트엔드
- 복지관홈페이지
- 웹개발
- 대학생
- Ajax
- 협회홈페이지제작
- 홈페이지제작비용
- php수정
- JavaScript
Archives
- Today
- Total
Hello se
[js]submit 전에 confirm띄우기 Confirm before a form submit 본문
반응형
form submit 할때 보내기전 확인창을 띄울때가 있다.
홈페이지를 만들다보면 무조건 필요하다고 생각하기에 올린당...
<form enctype="multipart/form-data" method="post" action="test_ok.php" name="morning" id="myForm">
<input type="text"name="name" class="input_">
<button type="submit" name="amode" value="no_test" onclick="no_really();" class="submit_btn" style="cursor:pointer;">접수</button>
</form>
우선 submit 을 button으로 했다 그리고 대충 테스트로 input암거나넣어보겠다
1. 스크립트이용
<script>
function no_really() {
if (confirm("정말로 취소하시겠습니까?")) {
// 삭제 동작 수행
var form = document.getElementById("myForm");
form.submit();
} else {
// 취소 동작 수행
window.history.back();
}
}
</script>
onclick을 이용해서 confirm알림창을 띄어주면된다
2. form에 onsubmit을 해주면된다
<form action="adminprocess.php" method="POST" onsubmit="return confirm('Are you sure you want to submit this form?');">
<input type="submit" name="completeYes" value="Complete Transaction" />
</form>
사실 이건 어디서 가지고온거다..
위에꺼 안되면 위에 있는 방법도 테스트해봐주세요!!
반응형
'web' 카테고리의 다른 글
[php]urlencode()함수 URL Encode방법 (0) | 2023.07.14 |
---|---|
[css]tr에 border적용안됨 (0) | 2023.07.07 |
네이버 애널리틱스 연동하기 (2) | 2023.06.07 |
[파일질라]한글파일 삭제 안될때 ftp No such file or directory (0) | 2023.06.02 |
[html]textarea 쓴 글 그대로 출력 , 띄어쓰기 가능 , nl2br함수 (1) | 2023.05.22 |
Comments