当前位置:编程学习 > JAVA >>

js如何判断textarea输入的内容不能为空或者全部为空格啊

String.prototype.trim = function() {
return this.replace(/(^\s*)|(\s*$)/g, "");
}
function saveThis(){
var subject = document.getElementById("subject").value;
var fatieContent = document.getElementById("fatieContent").value; alert("fatieContent:"+fatieContent.trim());
        if(subject.trim() ==''){
     alert("日志标题不能为空!");
     return false;
  }else if(fatieContent==''){
  alert("内容不能为空!");
  return false;
 }

<textarea name="fatieContent" id="fatieContent"  >
<s:property value="fatieContent" escape="false"/>
</textarea>

求指教关键是空格的处理 
   我输入了一排空格然后回车再空格 a 作为测试 其结果是

     </br>
     a


求高手解答 --------------------编程问答-------------------- <s:property value="fatieContent" escape="false"/>
  把这里面的escape参数改为true  就不会出现 了  
补充:Java ,  Java EE
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,