메뉴 건너뛰기

조회 수 194 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

1. 다음 우편번호 api 사용 -> 예제->사용자 지정 예제 복사 -> 스크립트 부분에 붙여넣기 -> input type  id 만 교체 

2. 비밀번호 확인 및 아이디 개수 체크

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE  >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script src="http://code.jquery.com/jquery-3.1.0.js">
    
</script>
 
 
 
<script>
    $(document).ready(function() {
        //아이디 중복체크
 
        $("#userid").keyup(function() {
            //사용자가 입력한 아이디
 
            var userid = $("#userid").val();
 
            var param = "userid=" + userid;
 
            if (userid.length >= 4) { //최소 글자수 이상
 
                //아이디 체크
 
                $.ajax({
                    type : "post",
                    url : "/web02/member_servlet/idcheck.do",
                    data : param,
                    success : function(result) {
 
                        $("#span_id").html(result);
 
                    }
 
                })
 
            }
 
        });
 
        //버튼클릭 이벤트
        $("#btnJoin").click(function() {
            var userid = $("#userid").val();
            var name = $("#name").val();
            var passwd = $("#passwd").val();
            var passwd2 = $("#passwd2").val();
 
            
            if(userid.length<4){
                
                alert("아이디를 입력하세요");
                $("#userid").focus();
                return;
            }
            
            if (name == "") {
 
                alert("이름을 입력하세요");
                $("#name").focus();
                return;
            }
 
            if (passwd != passwd2) {
 
                alert("비밀번호가 일치하지 않습니다.");
                $("#passwd2").val("");
 
                return;
            }
 
            //폼데이터를 서버에 제출
            document.form1.submit();
 
        });
 
    });
</script>
 
<script src="http://dmaps.daum.net/map_js_init/postcode.v2.js"></script>
<script>
    function sample6_execDaumPostcode() {
        new daum.Postcode(
                {
                    oncomplete : function(data) {
                        // 팝업에서 검색결과 항목을 클릭했을때 실행할 코드를 작성하는 부분.
 
                        // 각 주소의 노출 규칙에 따라 주소를 조합한다.
                        // 내려오는 변수가 값이 없는 경우엔 공백('')값을 가지므로, 이를 참고하여 분기 한다.
                        var fullAddr = ''// 최종 주소 변수
                        var extraAddr = ''// 조합형 주소 변수
 
                        // 사용자가 선택한 주소 타입에 따라 해당 주소 값을 가져온다.
                        if (data.userSelectedType === 'R') { // 사용자가 도로명 주소를 선택했을 경우
                            fullAddr = data.roadAddress;
 
                        } else { // 사용자가 지번 주소를 선택했을 경우(J)
                            fullAddr = data.jibunAddress;
                        }
 
                        // 사용자가 선택한 주소가 도로명 타입일때 조합한다.
                        if (data.userSelectedType === 'R') {
                            //법정동명이 있을 경우 추가한다.
                            if (data.bname !== '') {
                                extraAddr += data.bname;
                            }
                            // 건물명이 있을 경우 추가한다.
                            if (data.buildingName !== '') {
                                extraAddr += (extraAddr !== '' ? ', '
                                        + data.buildingName : data.buildingName);
                            }
                            // 조합형주소의 유무에 따라 양쪽에 괄호를 추가하여 최종 주소를 만든다.
                            fullAddr += (extraAddr !== '' ? ' (' + extraAddr
                                    + ')' : '');
                        }
 
                        // 우편번호와 주소 정보를 해당 필드에 넣는다.
                        document.getElementById('sample6_postcode').value = data.zonecode; //5자리 새우편번호 사용
                        document.getElementById('sample6_address').value = fullAddr;
 
                        // 커서를 상세주소 필드로 이동한다.
                        document.getElementById('sample6_address2').focus();
                    }
                }).open();
    }
</script>
 
</head>
<body>
 
 
    <h2>회원가입</h2>
 
 
    <form name="form1" method="post" action="/web02/member_servlet/join.do">
 
        <table border="1" width="700px">
            <tr>
                <td>이름</td>
                <td><input type="text" name="name" id="name"></td>
            </tr>
 
 
            <tr>
                <td>아이디</td>
                <td><input type="text" name="userid" id="userid"> <span
                    id="span_id"></span></td>
            </tr>
 
 
            <tr>
                <td>비밀번호</td>
                <td><input type="password" name="passwd" id="passwd"></td>
            </tr>
 
 
            <tr>
                <td>비밀번호확인</td>
                <td><input type="password" name="passwd2" id="passwd2"></td>
            </tr>
 
 
            <tr>
                <td>이메일</td>
                <td><input type="email" name="email" id="email"></td>
            </tr>
 
 
            <tr>
                <td>폰번호</td>
                <td><input type="text" name="hp" id="hp"></td>
            </tr>
 
 
            <tr>
                <td>우편번호</td>
                <!-- readonly 읽기만전용 -->
                <td><input type="text" name="zipcode" id="sample6_postcode"
                    readonly> <input type="button"
                    onclick="sample6_execDaumPostcode()" value="우편번호 찾기"></td>
            </tr>
 
 
            <tr>
                <td>주소</td>
                <td><input type="text" name="address1" id="sample6_address"
                    readonly></td>
            </tr>
 
 
            <tr>
                <td>주소상세</td>
                <td><input type="text" name="address2" id="sample6_address2"></td>
            </tr>
 
 
            <tr>
 
                <td align="center" colspan="2"><input type="button"
                    value="회원가입" id="btnJoin"> <input type="reset" value="취소">
 
                </td>
            </tr>
 
        </table>
    </form>
 
</body>
</html>
cs

 


  1. jsp header의 사용

    Date2021.03.31 Views188
    Read More
  2. jsp mybatis sample file and spring mvc

    Date2021.03.28 Views160
    Read More
  3. jsp - 각종 체크 &우편번호

    Date2021.03.28 Views194
    Read More
  4. jsp - 아이디 체크

    Date2021.03.28 Views313
    Read More
  5. jsp - 회원가입

    Date2021.03.28 Views223
    Read More
  6. JSP - 로그인 & AJAX 비동기 방식으로 처리&암호화&정규표현식

    Date2021.03.28 Views21623
    Read More
  7. JSP - 수정 삭제

    Date2021.03.28 Views187
    Read More
  8. JSP - filter 필터 &한글처리

    Date2021.03.28 Views161
    Read More
  9. JSP - 메모 상세 & EL

    Date2021.03.28 Views179
    Read More
  10. JSP - 한줄메모 삽입 & AJAX

    Date2021.03.28 Views167
    Read More
  11. JSP - JDBC&데이터 처리 순서&DB CONN 따로 분리

    Date2021.03.28 Views172
    Read More
  12. JSP - 태그문자&공백문자&줄바꿈 문자 처리

    Date2021.03.28 Views218
    Read More
  13. JSP - 한줄메모 목록 리스트 AJAX

    Date2021.03.28 Views192
    Read More
  14. JSP - MVC 패턴 & 도서 목록 컨트롤러에서 해당 URL 받아서 처리하기

    Date2021.03.27 Views165
    Read More
  15. JSP - DBCP 커넥션 풀

    Date2021.03.27 Views875
    Read More
  16. JSP - 페이지 화면이동 방식

    Date2021.03.27 Views169
    Read More
  17. JSP - MYSQL JSP insert 폼에서 servlet으로 값넘기기

    Date2021.03.27 Views183
    Read More
  18. JSP - MYSQL JSP 연동 &리스트 뽑아오기

    Date2021.03.27 Views237
    Read More
  19. JSP - 환경설정 및 기본개념

    Date2021.03.27 Views175
    Read More
  20. 파라미터를 배열 형식으로 받기

    Date2021.03.25 Views1477
    Read More
Board Pagination Prev 1 2 3 4 Next
/ 4

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved