//取fck內(nèi)容的長(zhǎng)度
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
}
//判斷是不是為空
function CheckPost(){
if(GetLength("content")<=0) //content為FCKeditor在頁(yè)面所設(shè)的名字
{
alert('請(qǐng)輸入內(nèi)容');
return false;
}
}
//取fck內(nèi)容
function GetContent(str)
{
var oEditor = FCKeditorAPI.GetInstance(str) ;
return oEditor.GetXHTML();
}
//去掉字符串的空格
String.prototype.trim = function()
{
return this.replace(/(^[\s]*)|([\s]*$)/g, "");
}
posted on 2009-07-23 19:37
田園風(fēng)光 閱讀(1234)
評(píng)論(1) 編輯 收藏