체크박스 동의 여부 스크립트 문의 채택완료
안녕하세요. 아래 처럼 소스를 짯는데 체크박스 부분만 얼럿창이 안되네요 ㅜ
고수님들 도와주삼요..
</p><p><form name="f1" method="post" enctype='multipart/form-data'></p><p>
</p><p>약관의 내용에 동의합니다.
<input type="checkbox" name="agree" value="1" id="agree"></p><p><input type="button" value="참가신청하기" onclick="form_Check();"></p><p>
</p><p></form></p><p>
</p><p>
</p><p></p><p><script>
function form_Check(){</p><p>
</p><p>if (!f.agree.checked) {
alert("약관 내용에 동의해주세요.");
f.agree.focus();
return false;
} </p><p>
</p><p> if(f1.name.value == ''){
alert("이름을 입력해주십시오.");
f1.name.focus();
return;
}</p><p>
</p><p>.</p><p>.</p><p>.</p><p>
</p><p></script></p><p>
</p><p>
</p><p>
</p><p>
답변 2개
</p><p><form name="f1" method="post" enctype='multipart/form-data' onsubmit="form_Check()"></p><p>
</p><p>약관의 내용에 동의합니다.</p><p><input type="checkbox" name="agree" value="1" id="agree"></p><p><input type="submit" value="참가신청하기"></p><p>
</p><p></form></p><p>
</p><p>
</p><p></p><p><script></p><p>function form_Check(){</p><p><span style="white-space:pre"> </span>if (!f1.agree.checked) { </p><p><span style="white-space:pre"> </span>alert("약관 내용에 동의해주세요."); </p><p><span style="white-space:pre"> </span>f1.agree.focus(); </p><p><span style="white-space:pre"> </span>return false; </p><p><span style="white-space:pre"> </span>} </p><p><span style="white-space:pre"> </span>if(f1.name.value == ''){</p><p><span style="white-space:pre"> </span> alert("이름을 입력해주십시오.");</p><p><span style="white-space:pre"> </span> f1.name.focus();</p><p><span style="white-space:pre"> </span> return false;</p><p><span style="white-space:pre"> </span> }</p><p>
</p><p>}</p><p>
</p><p>
</p><p></script></p><p>
</p><p>
</p><p>
</p><p>
댓글을 작성하려면 로그인이 필요합니다.
오타가 있네요
</p><p><code class="keyword" style="font-size: 14.004px; background-color: rgb(248, 248, 248); font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; margin: 0px !important; padding: 0px !important; border: 0px !important; outline: 0px !important; background-image: none !important; background-position: initial !important; background-size: initial !important; background-repeat: initial !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.8em !important; font-weight: bold !important; color: rgb(0, 102, 153) !important;">if</code><span style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-size: 14.004px; background-color: rgb(248, 248, 248);"> </span><code class="plain" style="font-size: 14.004px; background-color: rgb(248, 248, 248); font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; margin: 0px !important; padding: 0px !important; border: 0px !important; outline: 0px !important; background-image: none !important; background-position: initial !important; background-size: initial !important; background-repeat: initial !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.8em !important;">(!f.agree.checked) {</code> </p><p><code class="plain" style="font-size: 14.004px; background-color: rgb(248, 248, 248); font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; margin: 0px !important; padding: 0px !important; border: 0px !important; outline: 0px !important; background-image: none !important; background-position: initial !important; background-size: initial !important; background-repeat: initial !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.8em !important;">
부분에
f1이 되어야 할것 같구요
더 잘 작동하게 하시려면
</code></p><p>
</p><pre><p style="margin-left: 0px;">
<script>
function form_Check(){
var f = document.f1;
if (!f.agree.checked) {
alert("약관 내용에 동의해주세요.");
f.agree.focus();
return false;
}
if (f.name.value == ''){
alert("이름을 입력해주십시오.");
f.name.focus();
return;
}
.
.
.
</script></p></pre><div><span style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-size: 14.004px; background-color: rgb(248, 248, 248);">
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인