else if를 넣어야하는데 위치좀 가르쳐주세요 ㅠ
본문
코멘트 댓글 답변 취소하기를
Policia님꺼를 보고 해보려고 했는데요
내용은 =>
댓글에서 답변달기 버튼을 맨처음 1번 누르면 답변을 달수가 있고 //
다시 한번 누르면 답변달기가 취소되면서 원래 자리로 돌아간다고 합니다.
내용 : https://sir.kr/g5_tip/13322
view_comment.skin.php 에서 맨 아래줄쯤에 function comment_box 함수가 존재하는데
if (save_before != el_id)
이런 if문이 있어요
Policia님의 말씀으론 이 아래
else if(comment_id){
comment_box('', 'c');
}
이것만 넣으면 끝이라고 하셨는데 // 전 안되더라구요 이걸 어디다가 넣는지도 잘 모르겠어요
초심자라 아에 코드들을 하나도 알지 못하겠어요
그래서 그냥 if (save_before != el_id) 밑에다가 에라이 하나 얻어걸리겠지 하고
else if(comment_id){
comment_box('', 'c');
}
를 복사해서 한줄 한줄 다 넣어보고 새로고침해서 해보고..그래도 저는 안되더라구요.
어디줄에다가 뭘 빼먹었나싶어서 다시 그럴듯한곳에 넣어보고 해봐도..숨은그림찾기 하는거 같습니다 ㅠ
혹시나 해서 Policia님 홈페이지를 가봤는데 잘 돌아가고 있어요
if (save_before != el_id)
{
if (save_before)
{
document.getElementById(save_before).style.display = 'none';
document.getElementById(save_before).innerHTML = '';
}
document.getElementById(el_id).style.display = '';
document.getElementById(el_id).innerHTML = save_html;
// 댓글 수정
if (work == 'cu')
{
document.getElementById('wr_content').value = document.getElementById('save_comment_' + comment_id).value;
if (typeof char_count != 'undefined')
check_byte('wr_content', 'char_count');
if (document.getElementById('secret_comment_'+comment_id).value)
document.getElementById('wr_secret').checked = true;
else
document.getElementById('wr_secret').checked = false;
}
document.getElementById('comment_id').value = comment_id;
document.getElementById('w').value = work;
// 페이지
if (comment_id) {
document.getElementById('comment_page').value = document.getElementById('comment_page_'+comment_id).value;
document.getElementById('comment_url').value = document.getElementById('comment_url_'+comment_id).value;
//별점
if(work == 'c') {
$("#bo_vc_star").hide();
} else {
if(document.getElementById('star_comment_'+comment_id).value > 0) {
document.getElementById('wr_star').value = document.getElementById('star_comment_'+comment_id).value;
$("#bo_vc_star").show();
} else {
$("#bo_vc_star").hide();
}
}
} else {
document.getElementById('comment_page').value = '';
document.getElementById('comment_url').value = './view_comment.page.php?bo_table=<?php echo $bo_table;?>&wr_id=<?php echo $wr_id;?>&crows=<?php echo $crows;?>';
//별점
document.getElementById('wr_star').value = 5;
$("#bo_vc_star").show();
}
if(save_before)
$("#captcha_reload").trigger("click");
save_before = el_id;
}
}
function comment_delete()
{
return confirm("이 댓글을 삭제하시겠습니까?");
}
comment_box('', 'c'); // 댓글 입력폼이 보이도록 처리하기위해서 추가 (root님)
<?php if($board['bo_use_sns'] && ($config['cf_facebook_appid'] || $config['cf_twitter_key'])) { ?>
// sns 등록
$(function() {
$("#bo_vc_send_sns").load(
"<?php echo G5_SNS_URL; ?>/view_comment_write.sns.skin.php?bo_table=<?php echo $bo_table; ?>",
function() {
save_html = document.getElementById('bo_vc_w').innerHTML;
}
);
});
<?php } ?>
</script>
<?php } ?>
<?php } else { ?>
위치좀 가르쳐주셨으면 감사하겠습니다 ㅠ.ㅠ
!-->!-->!-->답변 2
그누위즈 님의 답변이 맞습니다.
if (save_before != el_id)
{
if (save_before)
{
document.getElementById(save_before).style.display = 'none';
document.getElementById(save_before).innerHTML = '';
}
document.getElementById(el_id).style.display = '';
document.getElementById(el_id).innerHTML = save_html;
// 댓글 수정
if (work == 'cu')
{
document.getElementById('wr_content').value = document.getElementById('save_comment_' + comment_id).value;
if (typeof char_count != 'undefined')
check_byte('wr_content', 'char_count');
if (document.getElementById('secret_comment_'+comment_id).value)
document.getElementById('wr_secret').checked = true;
else
document.getElementById('wr_secret').checked = false;
}
document.getElementById('comment_id').value = comment_id;
document.getElementById('w').value = work;
// 페이지
if (comment_id) {
document.getElementById('comment_page').value = document.getElementById('comment_page_'+comment_id).value;
document.getElementById('comment_url').value = document.getElementById('comment_url_'+comment_id).value;
//별점
if(work == 'c') {
$("#bo_vc_star").hide();
} else {
if(document.getElementById('star_comment_'+comment_id).value > 0) {
document.getElementById('wr_star').value = document.getElementById('star_comment_'+comment_id).value;
$("#bo_vc_star").show();
} else {
$("#bo_vc_star").hide();
}
}
} else {
document.getElementById('comment_page').value = '';
document.getElementById('comment_url').value = './view_comment.page.php?bo_table=<?php echo $bo_table;?>&wr_id=<?php echo $wr_id;?>&crows=<?php echo $crows;?>';
//별점
document.getElementById('wr_star').value = 5;
$("#bo_vc_star").show();
}
if(save_before)
$("#captcha_reload").trigger("click");
save_before = el_id;
} else if(comment_id){
comment_box('', 'c');
}
}
function comment_delete()
{
return confirm("이 댓글을 삭제하시겠습니까?");
}
comment_box('', 'c'); // 댓글 입력폼이 보이도록 처리하기위해서 추가 (root님)
<?php if($board['bo_use_sns'] && ($config['cf_facebook_appid'] || $config['cf_twitter_key'])) { ?>
// sns 등록
$(function() {
$("#bo_vc_send_sns").load(
"<?php echo G5_SNS_URL; ?>/view_comment_write.sns.skin.php?bo_table=<?php echo $bo_table; ?>",
function() {
save_html = document.getElementById('bo_vc_w').innerHTML;
}
);
});
<?php } ?>
</script>
<?php } ?>
<?php } else { ?>
답변을 작성하시기 전에 로그인 해주세요.