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