2026, 새로운 도약을 시작합니다.

form onclick으로 전송문의좀드려봅니다.형님들. 채택완료

9년 전 조회 5,966
Copy

여기서 궁금한것이 지금 alert 창을 띄워서 유효t성검사를 하고싶습니다. 검사할 input 은 w_date 입니다.

submit으로 했을때는 자신있느데 onclick은 모르겟네요 도움좀줏ㅔ요.ㅠㅠ

답변 2개

채택된 답변
+20 포인트

function form_submit() {

   var dt = document.getElementsByName("w_date")[0].value;

   if(dt) {

      document.excelForm.submit();

   } else {

      alert("값 입력");

      return false;

   }

}

onclick="excelForm.submit()" -> onclick="form_submit()" 

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

<form method="POST" id="excelForm" name="excelForm" action="search_excel.php">
<input type="text" id="w_date" name="w_date" value=""/>
</form>
 
 
 
<input type="button" class="button" value="고고싱" onclick="form_sub();" />

function form_sub() {

if(!$("#w_date").val()){

alert("경고내용");

$("#w_date").focus();

return false;

}

$("#excelForm").submit();

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인
🐛 버그신고