再試一下
<script>
String.prototype.Trim = function()
{
return this.replace(/(^\s*)|(\s*$)/g, "");
}
function abc()
{var temp=document.myform.area.text.value
var myvalue=(temp.Trim()).length(); 
alert(myvalue);
 return false;
}
</script>
<form name=myform action=a.htm onsubmit='return abc();'>
<input type=text name=area>
<input type=submit>
</form>