Fckeditor编辑器内容长度限制统计实现
先我们看最简单的就是编辑器的代码了,简单得很同时大家也经常看过。
代码如下 | 复制代码 |
<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="检测字数(包括HTML代码)" style="width:165px;" class="inputc" onClick="checklength()"> <script> |
//检测在线编器字符数 ,他必须通过创建FCKeditorAPI来实现,代码如下。
代码如下 | 复制代码 |
function checklength() { var Content; var oEditor = FCKeditorAPI.GetInstance('Content') ; Content=oEditor.GetXHTML(true) alert("n当前: "+Content.length+" 个字符"); return false; } |
</script>
再看实例,这里限制了fckeditor编辑器内容的长度哦,
代码如下 | 复制代码 |
window.onload=function(){ function FCKeditor_OnComplete() function editor_keydown(editor) |
本站原创文章,转载必须注明来源于http://www.zzzyk.com/wy/yw.html
补充:网页制作,js教程