关于ASP身份证问题

来源:百度知道 编辑:UC知道 时间:2024/05/14 06:11:58
我在网页中有一个要输入身份证号<input name=sfzh size=35 value="" maxlength="18">,但我想只能输入数字和大写的X,请问怎么设置。
能不能再设置一下,当他输入小写字母X时的时候,能够自动再变成大写的X

<input type="text" onpropertychange = "if(this.value!=''&&!this.value.match(/^[0-9X]+$/)){this.value=this.value.replace(/[^0-9X]/m,'')}" >
-----------------------------------------------
-------以下可换x 到 X---------------------------------------
<input type="text" onpropertychange ="chec(this)" >

<script language=javascript>
function chec(obj)
{

  if(obj.value!=''&&!obj.value.match(/^[0-9Xx]+$/))
  {
    obj.value=obj.value.replace(/[^0-9Xx]/m,'');
  }
  if(obj.value.indexOf('x') != -1)
  {
    obj.value=obj.value.replace('x','X');
  }
}
</script>