회원/비회원 게시판에 글 작성 시 fwrite_check에서 분기 처리 관련해서 질문드립니다. 채택완료
비회원은 체크항목이 2개가 보이고, 회원은 체크항목이 한개만 보이고 이 항목의 체크를 write.skin.php에서
fwrite_check()함수에서 처리해줄 때 비회원은 2개 다 ,회원은 1개의 체크항목에 체크가 되어있는지 확인해서
보내려고 합니다.
var agree3 = document.getElementsByName("agree3");
이 부분을 회원이면 체크하지 않고, 비회원이면 체크하게 하려면 어떻게 해야 할지 다른 분들의 조언 부탁드립니다.
Copy
function fwrite_check(f) { /* var s = ""; if (s = word_filter_check(f.wr_subject.value)) { alert("제목에 금지단어('"+s+"')가 포함되어있습니다"); return; } if (s = word_filter_check(f.wr_content.value)) { alert("내용에 금지단어('"+s+"')가 포함되어있습니다"); return; } */ if (document.getElementById('char_count')) { if (char_min > 0 || char_max > 0) { var cnt = parseInt(document.getElementById('char_count').innerHTML); if (char_min > 0 && char_min > cnt) { alert("내용은 "+char_min+"글자 이상 쓰셔야 합니다."); return; } else if (char_max > 0 && char_max < cnt) { alert("내용은 "+char_max+"글자 이하로 쓰셔야 합니다."); return; } } } var agree2 = document.getElementsByName("agree2"); if (agree2[0].checked) { f.wr_5.value = "1"; } else { f.wr_5.value = "0"; } var agree3 = document.getElementsByName("agree3"); if (agree3[0].checked) { f.wr_4.value = "1"; } else { f.wr_4.value = "0"; } if (!check_kcaptcha(f.wr_key)) { return false; } var geditor_status = document.getElementById("geditor_wr_content_geditor_status"); if (geditor_status != null) { if (geditor_status.value == "TEXT") { f.html.value = "html2"; } else if (geditor_status.value == "WYSIWYG") { f.html.value = "html1"; } } document.getElementById('btn_submit').disabled = true; document.getElementById('btn_list').disabled = true; <? if ($g4[https_url]) echo "f.action = '$g4[https_url]/$g4[bbs]/write_update.php';"; else echo "f.action = './write_update.php';"; ?> f.submit();}
답변 1개
채택된 답변
+20 포인트
불량학생™
11년 전
//비회원일때
if(!g5_is_member){
var agree3 = document.getElementsByName("agree3");
}
g5_is_member
g4_is_member
이건 그누보드 변수를 자바스크립트로 받는 변수에요
이부분을 확인하시면 되겠지요
로그인 후 평가할 수 있습니다
답변에 대한 댓글 1개
bismute
11년 전
감사합니다. 그누보드 변수를 자바스크립트로 받는 변수를 따로 생각하지 못했었는데...덕분에 하나 더 배워갑니다!
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인