只能匹配整数,不包括小数点、字母、汉字等.. 
用来验证QQ的。
问题补充:我输入小数点也照样接收...麻烦改改 
回 阳光上的桥 试了,123456.7 照样通过 
function checknum(theform) { 
if (theform.qq.value.search(/^[0-9]{5,9}$/) != -1 ){ 
return true; 
} 
else { 
alert("请正确输入QQ号!"); 
return false; 
} 
}
正确如下: 
<script type="text/javascript"> 
function checknum(theform) { 
if(!/^\d{5,9}$/.test(theform.qq.value)){ 
alert("请正确输入QQ号!"); 
return false; 
} 
return true; 
} 
</script> 
<form action="" method="get" onsubmit="return checknum(this)"> QQ:<input name="qq" type="text" /> <input name="" type="submit" value="提交"> 
</form>
