//fckEditor 内容长度 function GetLength(str){ var oEditor = FCKeditorAPI.GetInstance(str) ; var checkContent= oEditor.EditorDocument ; var contentLength ; if ( document.all ){ contentLength= checkContent.body.innerText.trim().length ; } else{ var r = checkContent.createRange() ; r.selectNodeContents( checkContent.body ) ; contentLength= r.toString().trim().length ; } return contentLength; } //去掉字符串的空格 String.prototype.trim = function() { return $.trim(this.replace(/(^[s]*)|([s]*$)/g, "")); }
var content = FCKeditorAPI.GetInstance("replyPosts").GetHTML(); if(content.length == 0 || GetLength("replyPosts") == 0){ showTip("发表不能为空",1,"info"); return false; }