잡동사니에도 사랑을

[JSP] MVC활용(4) - 아이디 중복체크, 우편번호 검색(mvcmember) 본문

JAVA_EE/MVC

[JSP] MVC활용(4) - 아이디 중복체크, 우편번호 검색(mvcmember)

luvforjunk 2021. 10. 13. 21:54
728x90
반응형

[21.10.13] MVC활용(4) - 아이디 중복체크, 우편번호 검색(mvcmember)

 

 

////////writeForm.jsp

<tr>
	<td width="100" align="center">아이디</td>
	<td>
		<input type="text" name="id" id="id" placeholder="아이디 입력">
		<input type="button" value="중복체크" id="checkIdBtn">
		<div id= "idDiv"></div>
	</td>	
</tr>

 

 

////////checkPost.jsp

<tr>
	<td align="center">${zipcodeDTO.zipcode }</td>
		<td colspan="3">
		 <%-- <a href="#" onclick="checkPostClose('${zipcodeDTO.zipcode }','${address }')">${address }</a> --%>
	     <a href="#" class="addressA">${address }</a>
	</td>
</tr>

 

<script type="text/javascript" src="http://code.jquery.com/jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="../js/member.js"></script>
<script type="text/javascript">
function checkPostClose(zipcode, address) {
	opener.writeForm.zipcode.value = zipcode;
	opener.writeForm.addr1.value = address;
	window.close();
	opener.writeForm.addr2.focus();
}
</script>
</body>
</html>

 

 

////////member.js

    $('#id', opener.document).val($('#checkId').val());
	$('#check', opener.document).val($('#checkId').val()); //중복체크 버튼을 눌렀는지 확인
	window.close();
	$('#pwd', opener.document).focus();
});

$('#zipcodeBtn').click(function(){
	window.open("/mvcmember/member/checkPost.do", "checkPost", "width=500 height=500 top=200 left=700");
});

$('.addressA').click(function(){
	//alert($(this).text()); - 주소
	//alert($(this).parent().prev().text()); - 우편번호
	
	$('#zipcode', opener.document).val($(this).parent().prev().text());
	$('#addr1', opener.document).val($(this).text());
	window.close();
	$('#addr2', opener.document).focus();
});

 

728x90
반응형