JavaScript 비밀번호 유효성 검사하기~~!!
JavaScript 부분
<script language="javascript">
function checkIt(){
if (userinput.pw.value != userinput.checkpw.value) {
alert("비밀번호가 일치하지 않습니다");
return false;
}
if(userinput.pw.value.length <8 || userinput.pw.value.length > 12){
alert("비밀번호를 8~12자 사이로 입력하세요");
return false;
}
</script>
사용자가 입력한 부분 중 id가 'pw'인 값을 받아 체크하여 alert창 이벤트 처리
body 부분
<h2>회원가입</h2>
<table class="type11">
<tr>
<th>아이디</th>
<td><input type="text" name="id" >
<input type="button" value="아이디 중복확인"
Onclick="openConfirmid(this.form)"></td>
</tr>
<tr>
<th class>비밀번호</th>
<td><input type="password" name="pw" id ="pw" placeholder="8~12사이로 입력하세요." required></td>
</tr>
</table>
'JS' 카테고리의 다른 글
JavaScript - 이메일 유효성 검사 (회원가입) (0) | 2021.02.19 |
---|---|
JS - 페이지 새로고침 div 새로고침, 요소삭제 (1) | 2021.02.10 |
댓글