<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
<script type="text/javascript">
function check(){
var str = form1.bx1.value;
for(var i=0;i<str.length;i++){
if(!((str.charCodeAt(i) >= 48 && str.charCodeAt(i) <= 57) ||
(str.charCodeAt(i) >= 65 && str.charCodeAt(i) <= 90) ||
(str.charCodeAt(i) >= 97 && str.charCodeAt(i) <= 122))){
alert("숫자와 영문만 입력 가능");
}//if
}
}
//숫자 체크 함수
function checkNum(num){
var flag=true;
for(var i=0;i<num.length;i++){
c = num.charAt(i);
if(!(c>='0' && c<='9')){
flag=false;
break;
}
}
return flag;
}
</script>
</head>
<body>
<form name="form1">
<input type="text" name="bx1">
<input type="button" onClick="check()">
</form>
</body>
</html>
댓글