最佳答案:代码示例:function testNum(str){var reg = new RegExp("^[^0-9]*$");//从头到尾都不是数字if(reg.test(str)){alert("没有数