分类: Java
2009-08-11 10:16:33
JS代码:
<script language="javascript">
String.prototype.mytrim = function()
{
return this.replace(/(^\s*)|(\s*$)/g, "");
}
String.prototype.myLTrim = function()
{
return this.replace(/(^\s*)/g, "");
}
String.prototype.myRTrim = function()
{
return this.replace(/(\s*$)/g, "");
}
function ckeckNum(){
var s =document.getElementById("number").value;
if(s.mytrim() == "") {
alert("不能为空");
return false;
}
if(isNaN(s))
{
alert("应为数字");
return false;
}
if(s<0)
{
alert("不得小于0");
return false;
}
return true;
}
<td><html:text property="number"
maxlength="8" style="width:50px">html:text>
%td>