方便以后,直记录下来
<script type="text/javascript"> //给原型护展tirm方法 String.prototype.trim=function() { return this.replace(/(^\s*)|(\s*$)/g,""); } function btn_save() { if(document.getElementById("txtRedoReason").value.trim() == "") { alert("請輸入重做原因!"); document.getElementById("txtRedoReason").focus(); return false; } return true; } </script>
原文:http://www.cnblogs.com/yzenet/p/3683255.html