日期:2014-05-16  浏览次数:20320 次

xheditor编辑器怎么判断不为空?!
我的代码如下:<script language="javascript">
<!--
function Tijiao()
{
if(document.form1.title.value=="")
{
alert("请输入标题");
form1.title.focus();
return false;
}
if(document.form1.name.value=="")
{
alert("请输入作者名称");
form1.name.focus();
return false;
}
if(document.form1.source.value=="")
{
alert("请输入信息来源");
form1.source.focus();
return false;
}
if(document.form1.RQ.value=="")
{
alert("请输入日期");
form1.RQ.focus();
return false;
}

 //-->
</script>

<form name="form1" action="" method="post" onSubmit="return Tijiao();">

 <textarea id="elm1" name="contents" class="$('#elm1').xheditor({tools:'simple'});" style="width:500px; height:200px;"></textarea>

</form>




1、使用判断文本域的话,提示不为空,但是输入内容后点击提交,会提示为空,如果在提交一次,才能添加上内容。
在js里添加的代码如下:

if(document.form1.contents.value=="")
{
alert("请输入内容");
return false;
}
2、上网查到的,使用下面的代码,可是不起作用。  
if (editor.getSource =="")
    {
        alert("留言内容不能为空!");
        editor.getSource.focus();
        return false;
    }
return true;
}

谁帮帮我看看呀。从昨天就找解决,头疼死我了。快帮帮我吧!!

------解决方案--------------------
elm1.value
------解决方案--------------------
我也是这个问题啊