详细信息(js代码)
程序员文章站
2022-03-20 13:30:38
...
[size=medium][color=blue]
js文件[/color][/size]
[size=large][color=blue]html代码[/color][/size]
js文件[/color][/size]
//文档编辑器
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;
}
[size=large][color=blue]html代码[/color][/size]
<!-- 内容 -->
<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>
上一篇: FCKEditor的使用02