JavaScript语言:
爱问回答修改答案的js方法
case 'editreply':
$("#editquotelink").val($("#quote_"+id).html());
//$('#editreply').val($('#post_'+id).html());
var old_reply = $('#post_'+id).html();
$("#editreply_div").iDialog({
title:'{langask_input_addtional}',
width:500,
height:'auto',
submit:function(){
//vareditreply =document.getElementByIdx_x('editreply').value;
var editreply = editor['editreply'].getContent();
var editquotelink = document.getElementById('editquotelink').value;
if( !(editor['editreply'].hasContents())) {
$("body").iTips({content:'{langask_null_enter}',css:'notice'});
return false;
}
var url = '{$_G[PHP_SELF]}?mod={$_G[mod]}&do=action&act=editreply&postid='+id;
$.post(url,{editreply:editreply,editquotelink:editquotelink},function(data){
if(data.IsSuccess){
$("body").iTips({content:'{langask_modify_success}',css:'success'});
$("#editreply_div").dialog('close');
$("#post_"+id).html(editreply);
if(editquotelink!=''){
$("#quotelink_title_{$replylist['postid']}").removeClass();
$("#quote_"+id).html(editquotelink);
}else if(data.isLocked){
$("body").iTips({content:'{langask_post_locked}',css:'warning'});
}else{
$("body").iTips({content:'{langask_modify_failure}',css:'error'});
}
}
},'json')
}
});
setTimeout(function(){
//设置编辑器的内容为之前回答的内容
editor['editreply'].setContent(old_reply);
//让编辑器在最顶层显示
$("#editreply").children().css("z-index",10000);
}, 1000);
break;