santiago1983

学无止境

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

character count plugin for ckeditor

a character count plugin for ckeditor, which could make your dev quite easy and fast.

Details:

  • textarea for ckeditor:
<textarea name="content" id="ckTemp">
</textarea>
  • hidden input tag for ckeditor counter:
<input type="hidden" name="ckTempCharCount" pos="1" symbol="." value="300">
</input>
  • name is based on which textarea they served for.
  • value is the max number of count characters by setting.(if you haven't set a value for it, it will be 500 by default.)
  • symbol is the symbol inserted into the number.for example:1,200.it can help us read the number better when it is large number.
  • pos is the position where the symbol would be placed. 

Go to My google Code to download it: http://code.google.com/p/ckeditor-charcount-plugin/ 

Example:

<html>
<head>
    <title>CKEditor Word Count Demonstration</title>
    <script type="text/javascript" src="jquery/jquery.1.4.min.js"></script>
   
    <script type="text/javascript" src="ckeditor/ckeditor.js"></script>

</head>

<body>
        <p>
            <label for="content">Content with 30 word limit</label>
            <textarea name="content"  id="ckTemp" ></textarea>
            <input type="hidden" name="ckTempCharCount" pos='1' symbol='.' value="300" />
        </p>
        
   <script type="text/javascript">
           
CKEDITOR.replace( 'ckTemp' , {toolbar: 'Basic', extraPlugins  : 'charcount', skin :'xo', resize_enabled: false, toolbar : [['Bold', 'Italic', 'TextColor']], removeDialogTabs : 'paste', enterMode : CKEDITOR.ENTER_BR});

</script> 
    
</body>
</html>
posted on 2012-05-21 23:20  santiago1983  阅读(299)  评论(0编辑  收藏  举报