테스트 사이트 - 개발 중인 베타 버전입니다

alert 메시지를 나오게 하고 싶은데.. 채택완료

다조아해 8년 전 조회 3,106

 

폼을 만들어서 사용하는데

폼 입력이 없으면 해당 alert 메시지를 나오게 하고 싶어서요

지금은 아래 그림처럼  이 필드는 반드시 입력해야 합니다. 이렇게 나오는데

"예금주 필드는 반드시 입력해야 합니다." 이렇게 나오게 하고 싶거든요.

방법 좀 알려주세요

 

</span></strong></p><p><span style='font-family: "나눔고딕",NanumGothic;'>        </span><span style='font-family: "나눔고딕",NanumGothic;'><tr></span>
<span style='font-family: "나눔고딕",NanumGothic;'>            <th scope="row"><label for="wr_1" class="clear text-center pt-10 font-weight-600 font-14">예금주</label></th></span>
<span style='font-family: "나눔고딕",NanumGothic;'>            <td class="font-weight-400 font-13"><input name=wr_1 id="wr_1" itemname="예금주" required class="frm_input required select1" size="30" maxlength="11" style="height:35px" required value="<?=$write[wr_1]?>"> </td></span>
<span style='font-family: "나눔고딕",NanumGothic;'>        </tr></span></p><p>
</p><p><span style='font-family: "나눔고딕",NanumGothic;'>        <tr></span>
<span style='font-family: "나눔고딕",NanumGothic;'>            <th scope="row"><label for="wr_2" class="clear text-center pt-10 font-weight-600 font-14">예금주</label></th></span>
<span style='font-family: "나눔고딕",NanumGothic;'>            <td class="font-weight-400 font-13"><input name=wr_2 id="wr_2" itemname="예금주" required class="frm_input required select1" size="30" maxlength="11" style="height:35px" required value="<?=$write[wr_2]?>"> </td></span>
<span style='font-family: "나눔고딕",NanumGothic;'>        </tr></span></p><p><strong><span style='font-family: "나눔고딕",NanumGothic;'>
 

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

답변 1개

채택된 답변
+20 포인트

</p><p><script language="JavaScript">
function form_check() {
  if(!input_form.name.value) { //input_form 이라는 폼테그 안에 name 이라는 인풋 테그에 값이 없을경우.
alert("name 필드에 값을 넣어주세요.");
input_form.name.focus();
    return;
  }
}
</script></p><p>

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

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

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

로그인