编辑器ckeditor

编辑器:
aspx页面:
<script type="text/javascript" charset="utf-8" src="./../Content/ckeditor/ckeditor.js"></script>

<style type="text/css">
.editor,.editorDiv { width: 450px; height: 60px; overflow: auto; text-align: left; border:1px solid #ccc; padding:5px; cursor:hand;}
.editorFoucs { border: 1px solid red; background: #F6F0AC;}
</style>

<div id="comment" name="评论内容" class="editor" ></div>

<div id="editorDialog" title="质量状态数据录入">
<textarea id="editor" name="editor" cols="80" rows="50"></textarea>
<div>还可输入 <span id="leaveId"></span>  字 <span id="limitId" style="display:none; color:red;">(长度超限,请控制在8000字符以内)</span></div>
<div class="text-notice" style="display:none;">友情提醒:您正在使用IE6,建议升级到IE8</div>
</div>


js:
var editor;
var currentEditorId = ""; //当前页面中所有的TextArea均在唯一的ckeditor对象中编辑,此值用于记录当前处于编辑状态的textarea的ID
var timerId = null; //定义定时器用于实时检测富文件编辑器还可输入的字数
var editorMaxLength = 7998;

$(function () {
initEditor();
});


function initEditor() {
$("#editorDialog").dialog(
{
show: "fast",
modal: true,
resizable: false,
bgiframe: false,
autoOpen: false,
width: 550,
buttons: {
"取消": function () {
$(this).dialog("close");
},
"确定": function () {
$("#" + currentEditorId).html(editor.getData());
$(this).dialog("close");
}
},
beforeclose: function (event, ui) {
if (timerId != null) {
clearTimeout(timerId);
timerId = null;
}

$("#" + currentEditorId).removeClass("editorFoucs");
if (editor) { editor.destroy(); editor = null; }
}
});

//绑定textarea的点击事件,以触发显示editor的dialog
$(".editor").bind("click", function () {
currentEditorId = $(this).attr("id");
showEditorDialog($(this).attr("name"));
});
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值