`
lluorongsheng
  • 浏览: 33805 次
  • 性别: Icon_minigender_1
  • 来自: 广州
文章分类
社区版块
存档分类
最新评论

详细信息(js代码)

阅读更多

js文件

//文档编辑器
function GetMessageLength(str)
{
    var oEditor = FCKeditorAPI.GetInstance(str) ;
    var oDOM = oEditor.EditorDocument ;
    var iLength ;

    if ( document.all )        // If Internet Explorer.
    {
        iLength = oDOM.body.innerText.length ;
    }
    else                    // If Gecko.
    {
        var r = oDOM.createRange() ;
        r.selectNodeContents( oDOM.body ) ;
        iLength = r.toString().length ;
    }
//    oEditor.InsertHtml('')
return iLength
}  

function CheckPost(){
    if(GetMessageLength("content")==0)
    {
        alert('内容不能为空');       
        return false;
    }
    return true;
}



html代码

<!-- 内容 -->
<script type="text/javascript" src="<%=basePath %>fckeditor/fckeditor.js"></script>
<script type="text/javascript">
	window.onload = function()
	{
		// Automatically calculates the editor base path based on the _samples directory.
		// This is usefull only for these samples. A real application should use something like this:
		// oFCKeditor.BasePath = '/fckeditor/' ;	// '/fckeditor/' is the default value.
		var sBasePath = "<%=basePath%>fckeditor/";
		var oFCKeditor = new FCKeditor( 'groupDet','620','500' ) ;
		oFCKeditor.BasePath	= sBasePath ;
		oFCKeditor.ReplaceTextarea() ;
	} 
</script>
<script type="text/javascript" src="<%=basePath%>js/checkFckEditor.js"></script>




分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics