//숫자랑 영문만 입력 가능 onkeyup="onOnlyAlphaNumber(this);"
function onOnlyAlphaNumber(obj) {
str = obj.value;
len = str.length;
ch = str.charAt(0);
for(i = 0; i < len; i++) {
ch = str.charAt(i);
if( (ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ) {
continue;
} else {
alert("영문과 숫자만 입력이 가능합니다.");
obj.value="";
obj.focus();
return false;
}
}
return true;
}
function onOnlyAlphaNumber(obj) {
str = obj.value;
len = str.length;
ch = str.charAt(0);
for(i = 0; i < len; i++) {
ch = str.charAt(i);
if( (ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ) {
continue;
} else {
alert("영문과 숫자만 입력이 가능합니다.");
obj.value="";
obj.focus();
return false;
}
}
return true;
}
댓글
댓글 쓰기