//去空
String.prototype.Trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"");}
String.prototype.Ltrim = function(){return this.replace(/(^\s*)/g, "");}
String.prototype.Rtrim = function(){return this.replace(/(\s*$)/g, "");}
if(document.getElementById("txtTitle").value.Trim() == "")
{
alert("请输入消息的标题!");
return;
}
txtTitle 为控件的ID