jquery fckediter插件的使用

第一步:导入需要的js文件(根据实际情况修改相应路径)

  1. <script src="../js/jquery.js" type=text/javascript></script>   
  2. <script src="../js/jquery.FCKEditor.js" type=text/javascript></script>   
  3. <script src="../fckeditor/fckeditor.js" type="text/javascript"></script> 



第二步:初始化(根据实际情况修改相应路径)

  1. //初始化FCKEditor   
  2.     $.fck.config = {path: '/这里是你的项目名称/fckeditor/', height: 400 ,toolbar:'Default'};   
  3.     $('textarea#ncontent').fck();  

或者

$('textarea').fck({path: '<s:url value='/fckeditor/'/>', toolbar: 'Default',width:'600',height:'400'});

 



其中#ncontent为页面你所绑定的textArea的id或name

第三步:取值

  1. var getcontent = $.fck.content('ncontent'''); //其中ncontent为页面你所绑定的textarea的id或name 

或者

  1. FCKeditorAPI.GetInstance('blogContent').GetXHTML( true );



第四步:赋值(更新的时候先把原有的值赋给textarea)

  1. var oEditor = FCKeditorAPI.GetInstance('ncontent');   
  2. oEditor.SetHTML(data.news_add.na_newscontent);  
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章