首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

ckeditor报错ckeditor 施用 uncaught exception: [CKEDITOR.editor] The instance

2012-09-01 
ckeditor报错ckeditor 使用 uncaught exception: [CKEDITOR.editor] The instance?config_front.js?$(func

ckeditor报错ckeditor 使用 uncaught exception: [CKEDITOR.editor] The instance

?config_front.js

?

$(function() {CKEDITOR.editorConfig = function( config ){/*config.language = 'zh-cn';config.toolbar = 'Background';config.toolbar_Background = [       ['Bold','Italic','Underline','Strike','-','Subscript','Superscript','RemoveFormat'],   ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo'],        ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl'],['NumberedList','BulletedList','-','Outdent','Indent'],       '/',        ['Styles','Format','Font','FontSize'],        ['TextColor','BGColor'],['Link','Unlink'],['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],['Maximize','ShowBlocks']       ];config.resize_enabled = false;config.font_names = 'Arial;Verdana;Times New Roman;Georgia;Tahoma;宋体;黑体;微软雅黑';config.disableObjectResizing = false;*/config.language = 'zh-cn';config.toolbar = 'Background';config.toolbar_Background = [       ['Bold','Italic','Underline','Strike','-','Subscript','Superscript','RemoveFormat'],   ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo'],        ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],       '/',        ['FontSize'],        ['TextColor','BGColor'],['Link','Unlink','Table'],   ['NumberedList','BulletedList','-','Outdent','Indent'],   ['BidiLtr','BidiRtl']    ];//config.entities = false;config.resize_enabled = false;config.disableObjectResizing = false;config.filebrowserImageUploadUrl = 'ckupload?type=Images'; };  editor = CKEDITOR.replace( 'caseText', { customConfig : 'config_front.js' }) ;?});

?? jsp:

?

<td colspan="2"><textarea escapeXml="true"></c:out> </textarea></td>
?

表单验证:我把表单所有属性列出来了,暂时只需要看 案例正文。

?

function save() {/* 必检字段 */var LastName = $("#LastName").val();// 客户姓氏var title = $("#title").val();// 案例标题var age = $("#age").val(); // 客户年龄var occupation = $("#occupation").val();// 客户身份var Income = $("#Income").val();// 月均收入var AnnualPremium = $("#AnnualPremium").val();// 年缴保费var CustomerDemand = $("#CustomerDemand").val();// 客户需求var caseText = editor.document.getBody().getHtml();// var caseText = $("#caseText").val();// 案例正文var InsuranceCompany = $("#InsuranceCompany").val(); // 保险公司var InsuranceProducts = $("#InsuranceProducts").val(); // 保险产品var appellation = $("#appellation").val(); // 称谓var sex = $("#sex").val(); // 性别var id = $("#id").val(); // id// 判断空if ($.trim(title) == '') {alert('案例标题');return false;}if ($.trim(LastName) == '') {alert('请输入姓氏');return false;}if ($.trim(age) == '') {alert('请选择年龄');return false;}if ($.trim(occupation) == '') {alert('请填写客户身份');return false;}if ($.trim(Income) == '') {alert('请填写月均收入');return false;}if ($.trim(AnnualPremium) == '') {alert('请填写年缴保费');return false;}if ($.trim(CustomerDemand) == '') {alert('请填写客户需求');return false;}if (CustomerDemand.length > 200) {alert("客户需求字数不能大于200字");return;}if ($.trim(editor.document.getBody().getText()) == '') {alert('请填写案例正文');return false;}if (caseText.length > 2000) {alert("案例正文字数不能大于2000字");return;}if ($.trim(InsuranceCompany) == 0) {alert('请填写保险公司');return false;}if ($.trim(InsuranceProducts) == '') {alert('请填写保险产品');return false;}// 判断格式if (!nameCheck('title')) {alert('请填写正确格式的标题!');return false;}if (!nameCheck('LastName')) {alert('请正确输入姓氏');return false;}if (!nameCheck('occupation')) {alert('请填写客户身份');return false;}if (!numCheck('Income')) {alert('请填写月均收入');return false;}if (!numCheck('AnnualPremium')) {alert('请填写年缴保费');return false;}if (!numCheck("Income")) {alert('请填写月均收入!');return false;}}

?

问题:我一进入页面之后报错,说我已经实例化了caseText,但是我只实例化一次啊。

?

解决方案:在页面中单独写个

?

<script>
var editor = CKEDITOR.replace( 'caseText', { customConfig : 'config_front.js' }) ;
</script>

?

即可, 把config_front.js的var editor = CKEDITOR.replace( 'caseText', { customConfig : 'config_front.js' }) ; 去掉即可。

?

?

还有其他的解决方式:

?

参考:http://www.toobull.com/

热点排行