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);  
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章