JavaScript - 檢查輸入範圍是否為0-9,a-z,A-Z,._

<script type="text/javascript" language="javascript" >
 function isRegisterUserName(s)
 {
  alert('isRegisterUserName');
  var textbox=window.document.getElementById(s);
  var patrn=/^[a-zA-Z]{1}([a-zA-Z0-9]|[._]){4,19}$/;
  alert("s.text:"+s.value);
  if (!patrn.exec(s.value)) return false
   return true
 }
</script>

沒有留言:

橫式廣告