<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "
http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
<title>Untitled Document</title>
</head>
<body>
<table>
<tr>
<td width=100>fp</td>
<td width=100>200/12/13</td>
<td width=100>c:/fp/fd</td>
</tr>
</table>
<input type="text" id="myInput" value="" />
<input type="button" value="È·¶¨" id="myButton" />
</body>
</html>
<script language="JavaScript" type="text/javascript">
function $(obj){
return document.getElementById(obj);
}
function checkIsInteger(str)
{
//Èç¹ûΪ¿Õ£¬Ôòͨ¹ýУÑé
if(str == "")
return true;
if(/^(\-?)(\d+)$/.test(str))
return true;
else
return false;
}
String.prototype.trim = function()
{
return this.replace(/(^[\s]*)|([\s]*$)/g, "");
}
$("myButton").onclick=function(){
if(checkIsInteger($("myInput").value.trim())){
alert("³É¹¦");
}else{
alert("Ö»ÄÜÊÇÊý×Ö");
}
}
</script>