如何判断FCKEditor的值是否为空?
如何判断FCKEditor的值是否为空?如果在用户在填入内容的时候提交就提示用户如果用户输入了就提交到服务端写入...
如何判断FCKEditor的值是否为空?
如果在用户在填入内容的时候提交就提示用户
如果用户输入了就提交到服务端写入 展开
如果在用户在填入内容的时候提交就提示用户
如果用户输入了就提交到服务端写入 展开
1个回答
展开全部
判断内容是不是空以及其他配置
<script type="text/javascript">
<!--
// 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 ='/fckeditor/';
var oFCKeditor = new FCKeditor( 'news_content' ) ;
oFCKeditor.BasePath = sBasePath ;
oFCKeditor.Height = 400 ;
oFCKeditor.Width = 600 ;
oFCKeditor.Value = '' ;
oFCKeditor.Create() ;
//-->
//取fck内容的长度
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("news_content")=='0')
{
alert('请输入内容');
return false;
}
}
//取fck内容
function GetMessageContent(str)
{
var oEditor = FCKeditorAPI.GetInstance(str) ;
return oEditor.GetXHTML();
}
</script>
写好的js函数,你看着调用吧
不会用的问我
<script type="text/javascript">
<!--
// 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 ='/fckeditor/';
var oFCKeditor = new FCKeditor( 'news_content' ) ;
oFCKeditor.BasePath = sBasePath ;
oFCKeditor.Height = 400 ;
oFCKeditor.Width = 600 ;
oFCKeditor.Value = '' ;
oFCKeditor.Create() ;
//-->
//取fck内容的长度
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("news_content")=='0')
{
alert('请输入内容');
return false;
}
}
//取fck内容
function GetMessageContent(str)
{
var oEditor = FCKeditorAPI.GetInstance(str) ;
return oEditor.GetXHTML();
}
</script>
写好的js函数,你看着调用吧
不会用的问我
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询