佳木斯湛栽影视文化发展公司

主頁 > 知識庫 > Fckeditor編輯器內(nèi)容長度限制統(tǒng)計實現(xiàn)方法

Fckeditor編輯器內(nèi)容長度限制統(tǒng)計實現(xiàn)方法

熱門標簽:網(wǎng)站文章發(fā)布 呼叫中心市場需求 銀行業(yè)務(wù) 美圖手機 智能手機 服務(wù)器配置 檢查注冊表項 鐵路電話系統(tǒng)
先我們看最簡單的就是編輯器的代碼了,簡單得很同時大家也經(jīng)常看過。
復(fù)制代碼 代碼如下:

script type="text/javascript" src="/editor/fckeditor.js">/script>
script type="text/javascript">
!--
var oFCKeditor = new FCKeditor( 'Content' ) ;
oFCKeditor.BasePath = "/editor/" ;
oFCKeditor.ToolbarSet = "User" ;
oFCKeditor.Value = '沒有最好,只有更好,大家努力' ;
oFCKeditor.Height = 450 ;
oFCKeditor.Width = 660 ;
oFCKeditor.Create() ;
//-->
/script>
input type="button" value="檢測字數(shù)(包括HTML代碼)" style="width:165px;" class="inputc" onClick="checklength()">
script>

//檢測在線編器字符數(shù) ,他必須通過創(chuàng)建FCKeditorAPI來實現(xiàn),代碼如下。
復(fù)制代碼 代碼如下:

function checklength()
{
var Content;
var oEditor = FCKeditorAPI.GetInstance('Content') ;
Content=oEditor.GetXHTML(true)
alert("n當(dāng)前: "+Content.length+" 個字符");
return false;
}
/script>

再看實例,這里限制了fckeditor編輯器內(nèi)容的長度哦,
復(fù)制代碼 代碼如下:

window.onload=function(){
function FCKeditor_OnComplete()
{
var editor = FCKeditorAPI.GetInstance('info') ;
editor.Events.AttachEvent('OnSelectionChange', editor_keydown);
}
function editor_keydown(editor)
{
var maxLength=3; //最大輸入字數(shù)
content= $(editor.EditorDocument.body).text();
var len= content.length;
var $info =$('#info');//存放提示信息
if(len maxLength){
.text("還可以輸入 "+(maxLength-len)+"字");
}
if(len == maxLength){
$info.text("字數(shù)達到上限");
}
if(len > maxLength){
$info.text(" 輸入字符超過"+maxLength+"個,請更改!");
}
}
FCKeditor_OnComplete()
}
您可能感興趣的文章:
  • FCKEditor超級鏈接默認新窗口打開的修改方法
  • Smarty中調(diào)用FCKeditor的方法
  • fckeditor編輯器下的自定義分頁符實現(xiàn)方法
  • FCKeditor編輯器添加圖片上傳功能及圖片路徑問題解決方法
  • ThinkPHP中FCKeditor編輯器的使用方法
  • fckeditor編輯器在php中的配置方法
  • FCKeditor 圖片上傳進度條不動的解決方法
  • php在頁面中調(diào)用fckeditor編輯器的方法
  • 瀏覽器執(zhí)行history.go(-1) FCKeditor編輯框內(nèi)顯示html源代碼的解決方法
  • FCK編輯器(FCKEditor)添加新按鈕和功能的修改方法
  • fckeditor粘貼Word時彈出窗口取消的方法

標簽:新疆 滄州 河南 上海 樂山 沈陽 紅河 長治

巨人網(wǎng)絡(luò)通訊聲明:本文標題《Fckeditor編輯器內(nèi)容長度限制統(tǒng)計實現(xiàn)方法》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    伽师县| 陆河县| 东光县| 宾川县| 革吉县| 深水埗区| 荆门市| 南通市| 天水市| 洞头县| 广东省| 太湖县| 克什克腾旗| 工布江达县| 鞍山市| 南投县| 休宁县| 呼伦贝尔市| 洛浦县| 镇远县| 济源市| 永宁县| 西安市| 本溪| 晋江市| 南郑县| 贡觉县| 舟山市| 河津市| 黄梅县| 辰溪县| 赫章县| 菏泽市| 韩城市| 无极县| 安宁市| 高台县| 彰化县| 师宗县| 且末县| 肇源县|