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

목록에서 코멘트 작성 채택완료

하우에버 9년 전 조회 3,505

http://sir.kr/g5_plugin/1443?sfl=wr_subject%7C%7Cwr_content&stx=ajax">http://sir.kr/g5_plugin/1443?sfl=wr_subject%7C%7Cwr_content&stx=ajax 

 

목록에서 ajax 방식으로 댓글작성을 하고싶어서.. 스킨을 수정해보고 있는데요

 

-------------------------------------------

A글

코멘트작성폼

코멘트작성폼

 

B글

 

C글

코멘트작성폼

-------------------------------------------

 

위와같이 코멘트작성폼이 제대로 뜨지도않고 작동도 안돼요..

사실 view_comment_skin의 작성폼 소스를 list_skin에 그대로 붙여넣은거라 작동이 안될거란건 예상했는데 어떻게 수정해야할지 모르겠습니다ㅠㅠ

질문이 막연한거같지만 뭘 수정해야할지 힌트라도 주실수 있을까요ㅠㅠ

 

 

</span></p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;"><?php if ($is_comment_write) {</p><p style="font-size: 14.6667px;">    if($w == '')</p><p style="font-size: 14.6667px;">        $w = 'c';</p><p style="font-size: 14.6667px;">?></p><p style="font-size: 14.6667px;"><!-- 댓글 쓰기 시작 { --></p><p style="font-size: 14.6667px;"><aside id="bo_vc_w"></p><p style="font-size: 14.6667px;">    <h2>댓글쓰기</h2></p><p style="font-size: 14.6667px;">    <form name="fviewcomment" action="" method="post" autocomplete="off" id="fviewcomment"></p><p style="font-size: 14.6667px;">    <input type="hidden" name="w" value="<?php echo $w ?>" id="w"></p><p style="font-size: 14.6667px;">    <input type="hidden" name="bo_table" value="<?php echo $bo_table ?>"></p><p style="font-size: 14.6667px;">    <input type="hidden" name="wr_id" value="<?php echo $wr_id ?>"></p><p style="font-size: 14.6667px;">    <input type="hidden" name="comment_id" value="<?php echo $c_id ?>" id="comment_id"></p><p style="font-size: 14.6667px;">    <input type="hidden" name="sca" value="<?php echo $sca ?>"></p><p style="font-size: 14.6667px;">    <input type="hidden" name="sfl" value="<?php echo $sfl ?>"></p><p style="font-size: 14.6667px;">    <input type="hidden" name="stx" value="<?php echo $stx ?>"></p><p style="font-size: 14.6667px;">    <input type="hidden" name="spt" value="<?php echo $spt ?>"></p><p style="font-size: 14.6667px;">    <input type="hidden" name="page" value="<?php echo $page ?>"></p><p style="font-size: 14.6667px;">    <input type="hidden" name="is_good" value=""></p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;">    <div class="tbl_frm01 tbl_wrap"></p><p style="font-size: 14.6667px;">        <table></p><p style="font-size: 14.6667px;">        <tbody></p><p style="font-size: 14.6667px;">        <?php if ($is_guest) { ?></p><p style="font-size: 14.6667px;">        <tr></p><p style="font-size: 14.6667px;">            <th scope="row"><label for="wr_name">이름<strong class="sound_only"> 필수</strong></label></th></p><p style="font-size: 14.6667px;">            <td><input type="text" name="wr_name" value="<?php echo get_cookie("ck_sns_name"); ?>" id="wr_name" required class="frm_input required" size="5" maxLength="20"></td></p><p style="font-size: 14.6667px;">        </tr></p><p style="font-size: 14.6667px;">        <tr></p><p style="font-size: 14.6667px;">            <th scope="row"><label for="wr_password">비밀번호<strong class="sound_only"> 필수</strong></label></th></p><p style="font-size: 14.6667px;">            <td><input type="password" name="wr_password" id="wr_password" required class="frm_input required" size="10" maxLength="20"></td></p><p style="font-size: 14.6667px;">        </tr></p><p style="font-size: 14.6667px;">        <?php } ?></p><p style="font-size: 14.6667px;">        <tr></p><p style="font-size: 14.6667px;">            <th scope="row"><label for="wr_secret">비밀글사용</label></th></p><p style="font-size: 14.6667px;">            <td><input type="checkbox" name="wr_secret" value="secret" id="wr_secret"></td></p><p style="font-size: 14.6667px;">        </tr></p><p style="font-size: 14.6667px;">        <?php if ($is_guest) { ?></p><p style="font-size: 14.6667px;">        <tr></p><p style="font-size: 14.6667px;">            <th scope="row">자동등록방지</th></p><p style="font-size: 14.6667px;">            <td><?php echo $captcha_html; ?></td></p><p style="font-size: 14.6667px;">        </tr></p><p style="font-size: 14.6667px;">        <?php } ?></p><p style="font-size: 14.6667px;">        <?php</p><p style="font-size: 14.6667px;">        if($board['bo_use_sns'] && ($config['cf_facebook_appid'] || $config['cf_twitter_key'])) {</p><p style="font-size: 14.6667px;">        ?></p><p style="font-size: 14.6667px;">        <tr></p><p style="font-size: 14.6667px;">            <th scope="row">SNS 동시등록</th></p><p style="font-size: 14.6667px;">            <td id="bo_vc_send_sns"></td></p><p style="font-size: 14.6667px;">        </tr></p><p style="font-size: 14.6667px;">        <?php</p><p style="font-size: 14.6667px;">        }</p><p style="font-size: 14.6667px;">        ?></p><p style="font-size: 14.6667px;">        <tr></p><p style="font-size: 14.6667px;">            <th scope="row">내용</th></p><p style="font-size: 14.6667px;">            <td></p><p style="font-size: 14.6667px;">                <?php if ($comment_min || $comment_max) { ?><strong id="char_cnt"><span id="char_count"></span>글자</strong><?php } ?></p><p style="font-size: 14.6667px;">                <textarea id="wr_content" name="wr_content" maxlength="10000" required class="required" title="내용"</p><p style="font-size: 14.6667px;">                <?php if ($comment_min || $comment_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?php } ?>><?php echo $c_wr_content;  ?></textarea></p><p style="font-size: 14.6667px;">                <?php if ($comment_min || $comment_max) { ?><script> check_byte('wr_content', 'char_count'); </script><?php } ?></p><p style="font-size: 14.6667px;">                <script></p><p style="font-size: 14.6667px;">                $(document).on( "keyup change", "textarea#wr_content[maxlength]", function(){</p><p style="font-size: 14.6667px;">                    var str = $(this).val()</p><p style="font-size: 14.6667px;">                    var mx = parseInt($(this).attr("maxlength"))</p><p style="font-size: 14.6667px;">                    if (str.length > mx) {</p><p style="font-size: 14.6667px;">                        $(this).val(str.substr(0, mx));</p><p style="font-size: 14.6667px;">                        return false;</p><p style="font-size: 14.6667px;">                    }</p><p style="font-size: 14.6667px;">                });</p><p style="font-size: 14.6667px;">                </script></p><p style="font-size: 14.6667px;">            </td></p><p style="font-size: 14.6667px;">        </tr></p><p style="font-size: 14.6667px;">        </tbody></p><p style="font-size: 14.6667px;">        </table></p><p style="font-size: 14.6667px;">    </div></p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;">    <div class="btn_confirm"></p><p style="font-size: 14.6667px;">        <input type="submit" id="btn_submit" class="btn_submit" value="댓글등록"></p><p style="font-size: 14.6667px;">    </div></p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;">    </form></p><p style="font-size: 14.6667px;"></aside></p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;"><script></p><p style="font-size: 14.6667px;">$(function() {</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">	</span>var working = false;</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">	</span>$('#fviewcomment').submit(function(e)</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">	</span>{</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>e.preventDefault();</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>var f = e.target;</p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>var pattern = /(^\s*)|(\s*$)/g; // \s 공백 문자</p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>f.is_good.value = 0;</p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>var subject = "";</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>var content = "";</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>$.ajax({</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>url: g5_bbs_url+"/ajax.filter.php",</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>type: "POST",</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>data: {</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>"subject": "",</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>"content": f.wr_content.value</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>},</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>dataType: "json",</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>async: false,</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>cache: false,</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>success: function(data, textStatus) {</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>subject = data.subject;</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>content = data.content;</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>}</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>});</p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>if (content) {</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>alert("내용에 금지단어('"+content+"')가 포함되어있습니다");</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>f.wr_content.focus();</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>return false;</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>}</p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>// 양쪽 공백 없애기</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>var pattern = /(^\s*)|(\s*$)/g; // \s 공백 문자</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>document.getElementById('wr_content').value = document.getElementById('wr_content').value.replace(pattern, "");</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>if (char_min > 0 || char_max > 0)</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>{</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>check_byte('wr_content', 'char_count');</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>var cnt = parseInt(document.getElementById('char_count').innerHTML);</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>if (char_min > 0 && char_min > cnt)</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>{</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>alert("댓글은 "+char_min+"글자 이상 쓰셔야 합니다.");</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>return false;</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>} else if (char_max > 0 && char_max < cnt)</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>{</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>alert("댓글은 "+char_max+"글자 이하로 쓰셔야 합니다.");</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>return false;</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>}</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>}</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>else if (!document.getElementById('wr_content').value)</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>{</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>alert("댓글을 입력하여 주십시오.");</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>return false;</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>}</p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>if (typeof(f.wr_name) != 'undefined')</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>{</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>f.wr_name.value = f.wr_name.value.replace(pattern, "");</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>if (f.wr_name.value == '')</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>{</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>alert('이름이 입력되지 않았습니다.');</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>f.wr_name.focus();</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>return false;</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>}</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>}</p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>if (typeof(f.wr_password) != 'undefined')</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>{</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>f.wr_password.value = f.wr_password.value.replace(pattern, "");</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>if (f.wr_password.value == '')</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>{</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>alert('비밀번호가 입력되지 않았습니다.');</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>f.wr_password.focus();</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>return false;</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>}</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>}</p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span><?php if($is_guest) echo chk_captcha_js();  ?></p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>if(working) return false;</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>working = true;</p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>$.ajax({</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>url: g5_bbs_url+"/write_comment_update.php",</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>type: 'post',</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>data: $(this).serialize(),</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>success: function (data) {</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>working = false;</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>var arr = $.parseJSON(data);</p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>if(arr.status == 1) //최하층 입력인 경우</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>{</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">					</span>$('#bo_vc_empty').remove();</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">					</span>$("#captcha_reload").trigger("click");</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">					</span>$("#captcha_key").val("");</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">					</span>document.getElementById('wr_content').value = "";</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">					</span>$(arr.html).hide().appendTo($('#bo_vc')).slideDown();</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>}</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>else if(arr.status == 2) //대댓글 입력인 경우</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>{</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">					</span>comment_box('', 'c');</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">					</span>$("#captcha_reload").trigger("click");</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">					</span>$("#captcha_key").val("");</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">					</span>$(arr.html).hide().insertAfter('#bo_vc article#c_'+arr.id).slideDown();</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>}</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>else if(arr.status == 3) //수정</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>{</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">					</span>comment_box('', 'c');</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">					</span>$("#captcha_reload").trigger("click");</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">					</span>$("#captcha_key").val("");</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">					</span>$('#c_'+arr.id+' p').fadeOut("fast", function(){</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">						</span>$(this).html(arr.content);</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">						</span>$(this).fadeIn("fast");</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">						</span>$('#save_comment_'+arr.id).html(arr.content1);</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">						</span></p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">						</span>console.log(arr.secret, arr.id);</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">						</span>if (arr.secret) {</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">							</span>document.getElementById('secret_comment_'+arr.id).value = "secret";</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">						</span>} else {</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">							</span>document.getElementById('secret_comment_'+arr.id).value = "";</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">						</span>}</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">					</span>});</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>}</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>else //실패</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>{</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">					</span>alert('실패');</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>}</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>}</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>});</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">	</span>});</p><p style="font-size: 14.6667px;">});</p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;">var save_before = '';</p><p style="font-size: 14.6667px;">function comment_box(comment_id, work)</p><p style="font-size: 14.6667px;">{</p><p style="font-size: 14.6667px;">    var el_id;</p><p style="font-size: 14.6667px;">    // 댓글 아이디가 넘어오면 답변, 수정</p><p style="font-size: 14.6667px;">    if (comment_id)</p><p style="font-size: 14.6667px;">    {</p><p style="font-size: 14.6667px;">        if (work == 'c')</p><p style="font-size: 14.6667px;">            el_id = 'reply_' + comment_id;</p><p style="font-size: 14.6667px;">        else</p><p style="font-size: 14.6667px;">            el_id = 'edit_' + comment_id;</p><p style="font-size: 14.6667px;">    }</p><p style="font-size: 14.6667px;">    else</p><p style="font-size: 14.6667px;">        el_id = 'bo_vc_w';</p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;">    if (save_before != el_id)</p><p style="font-size: 14.6667px;">    {</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>$("#fviewcomment").appendTo($('#'+el_id));</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span></p><p style="font-size: 14.6667px;">        // 댓글 수정</p><p style="font-size: 14.6667px;">        if (work == 'cu')</p><p style="font-size: 14.6667px;">        {</p><p style="font-size: 14.6667px;">            document.getElementById('wr_content').value = document.getElementById('save_comment_' + comment_id).value;</p><p style="font-size: 14.6667px;">            if (typeof char_count != 'undefined')</p><p style="font-size: 14.6667px;">                check_byte('wr_content', 'char_count');</p><p style="font-size: 14.6667px;">            if (document.getElementById('secret_comment_'+comment_id).value)</p><p style="font-size: 14.6667px;">                document.getElementById('wr_secret').checked = true;</p><p style="font-size: 14.6667px;">            else</p><p style="font-size: 14.6667px;">                document.getElementById('wr_secret').checked = false;</p><p style="font-size: 14.6667px;">        }</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>else</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>{</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span> document.getElementById('wr_content').value = "";</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>}</p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;">        document.getElementById('comment_id').value = comment_id;</p><p style="font-size: 14.6667px;">        document.getElementById('w').value = work;</p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;">        if(save_before)</p><p style="font-size: 14.6667px;">            $("#captcha_reload").trigger("click");</p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;">        save_before = el_id;</p><p style="font-size: 14.6667px;">    }</p><p style="font-size: 14.6667px;">}</p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;">function comment_delete(href)</p><p style="font-size: 14.6667px;">{</p><p style="font-size: 14.6667px;">    if (confirm("이 댓글을 삭제하시겠습니까?")) {</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span></p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>if (href.split("/")[4].split("?")[0] == "password.php")</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>{</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>document.location.href = href;</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>}</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>else</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>{</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>var data = href.split("?")[1];</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>var id = href.split("comment_id=")[1].split("&")[0];</p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>$.ajax({</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>url: g5_bbs_url+"/delete_comment.php",</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>type: 'post',</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>data: data,</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>success: function() {<span class="Apple-tab-span" style="white-space: pre;">			</span></p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">					</span>if($("#c_"+id+" form").length) {</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">						</span>comment_box('', 'c'); //수정의 경우</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">					</span>}</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">					</span>$("#c_"+id).slideUp(function(){ $(this).remove(); });</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">				</span>}</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">			</span>});</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">		</span>}</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">	</span>}</p><p style="font-size: 14.6667px;">}</p><p style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space: pre;">	</span></p><p style="font-size: 14.6667px;">function good_and_write()</p><p style="font-size: 14.6667px;">{</p><p style="font-size: 14.6667px;">    var f = document.fviewcomment;</p><p style="font-size: 14.6667px;">    if (fviewcomment_submit(f)) {</p><p style="font-size: 14.6667px;">        f.is_good.value = 1;</p><p style="font-size: 14.6667px;">        f.submit();</p><p style="font-size: 14.6667px;">    } else {</p><p style="font-size: 14.6667px;">        f.is_good.value = 0;</p><p style="font-size: 14.6667px;">    }</p><p style="font-size: 14.6667px;">}</p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;">comment_box('', 'c'); // 댓글 입력폼이 보이도록 처리하기위해서 추가 (root님)</p><p style="font-size: 14.6667px;"> </p><p style="font-size: 14.6667px;"><?php if($board['bo_use_sns'] && ($config['cf_facebook_appid'] || $config['cf_twitter_key'])) { ?></p><p style="font-size: 14.6667px;">// sns 등록</p><p style="font-size: 14.6667px;">$(function() {</p><p style="font-size: 14.6667px;">    $("#bo_vc_send_sns").load(</p><p style="font-size: 14.6667px;">        "<?php echo G5_SNS_URL; ?>/view_comment_write.sns.skin.php?bo_table=<?php echo $bo_table; ?>",</p><p style="font-size: 14.6667px;">        function() {</p><p style="font-size: 14.6667px;">            save_html = document.getElementById('bo_vc_w').innerHTML;</p><p style="font-size: 14.6667px;">        }</p><p style="font-size: 14.6667px;">    );</p><p style="font-size: 14.6667px;">});</p><p style="font-size: 14.6667px;"><?php } ?></p><p style="font-size: 14.6667px;"></script></p><p style="font-size: 14.6667px;"><?php } ?></p><p style="font-size: 14.6667px;"><!-- } 댓글 쓰기 끝 -->

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

답변 1개

채택된 답변
+20 포인트
복스리
9년 전

혹시 댓글등록은 잘되나요?

생각보다 복잡한데 스크립트 오류확인부터 해보셔야할듯하구요.!

 

그냥 등록은 iframe으로 처리하시고..등록후 가지고 오는것만 ajax로 하심이 훨신 간편할듯 예상됩니다.

 

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

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

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

로그인