input表单设置只能输入字母或数字
只能输入数字
<input type="text" id="f" />
<script>
f.onkeyup = function(){
this.value = this.value.replace(/[^0-9]/, '');
};
</script>
只能输入字母
<input type="text" id="f" />
<script>
f.onkeyup = function(){
this.value = this.value.replace(/[^a-z]/i, '');
};
</script>