<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>