2021-01-08 HTML 영문자 입력받고, 영문자인지 아닌지, 대소문자인지 체크

쪼레비·2021년 3월 30일
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>

<script>
	do{
		var input = prompt("영문자를 입력 : ", "한 문자만 입력해주세요");

		if(input.length == 1){	// 한글자 입력
			if (parseInt(input) == 99) {
				break;
			} 
			else if (isNaN(input)) {	//	영문자 일 경우에만 대소문자 구분
				document.write("영문자입니다");
				
				if(input == input.toUpperCase()){
					document.write(" 이며 대문자입니다");
				}
				else if(input == input.toLowerCase()){
					document.write(" 이며 소문자입니다");
				}
				document.write("<br>");
			} else {
				document.write("영문자가 아닙니다.<br>");
			}
		}
		else{	// 한글자만 넣지 않았을 경우
			continue;
		}
	}while(true);
	
</script>

</head>
<body>

</body>
</html>
profile
잠팅이

0개의 댓글