文本框中只能出现数字
<input type="text" value="test" onkeyup="value=value.replace(/[^\d]/g,'')"> 去掉字符串中的空格
function str(str){ return str.replace(/\s/g,""); }