2010年9月10日
1、只能输入数字
onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"
例子:
<tr rowspan="2">
请输入年份:<input type="text" name="year" id="yearid" style="width:180px;" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"> (参照格式:YYYY)
</tr>引用
效果:在输入框进行输入时,无法填写除数字外的东东..