只能输入汉字(有闪动):
<input type="text" id="searchStr" name="searchStr" value="请输入姓名"
onkeyup="this.value=this.value.replace(/[^\u4E00-\u9FA5]/g,'')" />
只能输入数字(有闪动):
<input type="text" id="searchStr" name="searchStr" value="请输入身份证号码"
onkeyup="this.value=this.value.replace(/[^\d]/g,'')" />
只能输入汉字、字母和数字(无闪动):
<input type="text" id="searchStr" name="searchStr" value="请输入姓名或身份证号"
onkeypress="return /[\w\u4e00-\u9fa5]/.test(String.fromCharCode(window.event.keyCode))"
onpaste="return !/[^\w\u4e00-\u9fa5]/g.test(window.clipboardData.getData('Text'))"
ondragenter="return false"/>