<script>
function checkValue(value){
 var reg=/^\w+$/gi;
 alert(reg.test(value));
}
</script>
<input type="text" onblur="checkValue(this.value)">