onkeyup=”(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,”);}).call(this)” 在input 中加入这句话即可