Showing
3 changed files
with
77 additions
and
7 deletions
project/NaverOpenApi.png
0 → 100644
19.3 KB
| ... | @@ -346,7 +346,9 @@ select::-ms-expand { | ... | @@ -346,7 +346,9 @@ select::-ms-expand { |
| 346 | "question-grade question-grade question-grade input-grade input-grade"; | 346 | "question-grade question-grade question-grade input-grade input-grade"; |
| 347 | } | 347 | } |
| 348 | 348 | ||
| 349 | -.input-home { grid-area: input-home; } | 349 | +.input-home { |
| 350 | + display : relative; | ||
| 351 | + grid-area: input-home; } | ||
| 350 | 352 | ||
| 351 | .question-grade { grid-area: question-grade; } | 353 | .question-grade { grid-area: question-grade; } |
| 352 | 354 | ||
| ... | @@ -364,6 +366,35 @@ select::-ms-expand { | ... | @@ -364,6 +366,35 @@ select::-ms-expand { |
| 364 | } | 366 | } |
| 365 | 367 | ||
| 366 | 368 | ||
| 369 | +.button-address{ | ||
| 370 | + width:100px; | ||
| 371 | + height:auto; | ||
| 372 | + background-color: darkgrey; | ||
| 373 | + border: none; | ||
| 374 | + color:#fff; | ||
| 375 | + text-align: center; | ||
| 376 | + text-decoration: none; | ||
| 377 | + display: inline-block; | ||
| 378 | + font-size: 15px; | ||
| 379 | + margin: 4px; | ||
| 380 | + cursor: pointer; | ||
| 381 | +} | ||
| 382 | + | ||
| 383 | +#sample4_roadAddress{ | ||
| 384 | + width: 100%; | ||
| 385 | + height: auto; | ||
| 386 | + line-height : normal; | ||
| 387 | + padding: .8em .5em; | ||
| 388 | + font-family: inherit; | ||
| 389 | + border: 1px solid #999; | ||
| 390 | + border-radius: 0; | ||
| 391 | + outline-style: none; | ||
| 392 | + -webkit-appearance: none; | ||
| 393 | + -moz-appearance: none; appearance: none; | ||
| 394 | + | ||
| 395 | +} | ||
| 396 | + | ||
| 397 | + | ||
| 367 | #semester{ | 398 | #semester{ |
| 368 | width: 200px; | 399 | width: 200px; |
| 369 | padding: .2em .5em; | 400 | padding: .2em .5em; | ... | ... |
| ... | @@ -29,14 +29,13 @@ | ... | @@ -29,14 +29,13 @@ |
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | - <script type="text/css"> | 32 | +<script type="text/css"> |
| 33 | window.onload = function(){ | 33 | window.onload = function(){ |
| 34 | document.getElementById('btn').onclick = function(){ | 34 | document.getElementById('btn').onclick = function(){ |
| 35 | document.getElementById('frm').submit(); | 35 | document.getElementById('frm').submit(); |
| 36 | return false; | 36 | return false; |
| 37 | }; | 37 | }; |
| 38 | }; | 38 | }; |
| 39 | - | ||
| 40 | </script> | 39 | </script> |
| 41 | 40 | ||
| 42 | </head> | 41 | </head> |
| ... | @@ -82,12 +81,15 @@ | ... | @@ -82,12 +81,15 @@ |
| 82 | <div class="grid-container"> | 81 | <div class="grid-container"> |
| 83 | <div class="question-field question-home">어디에 사나요?</div> | 82 | <div class="question-field question-home">어디에 사나요?</div> |
| 84 | <div class="input-field input-home"> | 83 | <div class="input-field input-home"> |
| 85 | - <label for="question-input-field"></label> | 84 | + <input type="button" class="button-address" onclick="sample4_execDaumPostcode()" value="우편번호 찾기"><br> |
| 86 | - <input type="text" id="start"></div> | 85 | + <input type="text" id="sample4_roadAddress" placeholder="도로명주소"> |
| 86 | + <span id="guide" style="color:#999;display:none"></span> | ||
| 87 | + </div> | ||
| 87 | <div class="question-field question-school">무슨 학교에 다니나요?</div> | 88 | <div class="question-field question-school">무슨 학교에 다니나요?</div> |
| 88 | <div class="input-school"> | 89 | <div class="input-school"> |
| 89 | - <label for="question-input-field"></label> | 90 | + <input type="button" class="button-address" onclick="sample4_execDaumPostcode()" value="우편번호 찾기"><br> |
| 90 | - <input type="text" id="end"> | 91 | + <input type="text" id="sample4_roadAddress" placeholder="도로명주소"> |
| 92 | + <span id="guide" style="color:#999;display:none"></span> | ||
| 91 | </div> | 93 | </div> |
| 92 | <div class="question-field question-grade">몇학년인가요?</div> | 94 | <div class="question-field question-grade">몇학년인가요?</div> |
| 93 | <div class="input-grade"><div class="custom-select" style="width:208px; margin-right:40px"> | 95 | <div class="input-grade"><div class="custom-select" style="width:208px; margin-right:40px"> |
| ... | @@ -164,6 +166,43 @@ | ... | @@ -164,6 +166,43 @@ |
| 164 | <script src="magnific-popup/jquery.magnific-popup.min.js"></script> | 166 | <script src="magnific-popup/jquery.magnific-popup.min.js"></script> |
| 165 | <script src="js/jquery.singlePageNav.min.js"></script> | 167 | <script src="js/jquery.singlePageNav.min.js"></script> |
| 166 | <script src="js/bootstrap.min.js"></script> | 168 | <script src="js/bootstrap.min.js"></script> |
| 169 | + <script src="https://t1.daumcdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js"></script> | ||
| 170 | + <script> //도로명주소 | ||
| 171 | + function sample4_execDaumPostcode() { | ||
| 172 | + new daum.Postcode({ | ||
| 173 | + oncomplete: function(data) { | ||
| 174 | + // 팝업에서 검색결과 항목을 클릭했을때 실행할 코드를 작성하는 부분. | ||
| 175 | + | ||
| 176 | + // 도로명 주소의 노출 규칙에 따라 주소를 표시한다. | ||
| 177 | + // 내려오는 변수가 값이 없는 경우엔 공백('')값을 가지므로, 이를 참고하여 분기 한다. | ||
| 178 | + var roadAddr = data.roadAddress; // 도로명 주소 변수 | ||
| 179 | + | ||
| 180 | + | ||
| 181 | + // 우편번호와 주소 정보를 해당 필드에 넣는다. | ||
| 182 | + document.getElementById("sample4_roadAddress").value = roadAddr; | ||
| 183 | + | ||
| 184 | + // 참고항목 문자열이 있을 경우 해당 필드에 넣는다. | ||
| 185 | + | ||
| 186 | + var guideTextBox = document.getElementById("guide"); | ||
| 187 | + // 사용자가 '선택 안함'을 클릭한 경우, 예상 주소라는 표시를 해준다. | ||
| 188 | + if(data.autoRoadAddress) { | ||
| 189 | + var expRoadAddr = data.autoRoadAddress + extraRoadAddr; | ||
| 190 | + guideTextBox.innerHTML = '(예상 도로명 주소 : ' + expRoadAddr + ')'; | ||
| 191 | + guideTextBox.style.display = 'block'; | ||
| 192 | + | ||
| 193 | + } else if(data.autoJibunAddress) { | ||
| 194 | + var expJibunAddr = data.autoJibunAddress; | ||
| 195 | + guideTextBox.innerHTML = '(예상 지번 주소 : ' + expJibunAddr + ')'; | ||
| 196 | + guideTextBox.style.display = 'block'; | ||
| 197 | + } else { | ||
| 198 | + guideTextBox.innerHTML = ''; | ||
| 199 | + guideTextBox.style.display = 'none'; | ||
| 200 | + } | ||
| 201 | + } | ||
| 202 | + }).open(); | ||
| 203 | + } | ||
| 204 | + </script> | ||
| 205 | + | ||
| 167 | <script> //dropdown list | 206 | <script> //dropdown list |
| 168 | var x, i, j, l, ll, selElmnt, a, b, c; | 207 | var x, i, j, l, ll, selElmnt, a, b, c; |
| 169 | /*look for any elements with the class "custom-select":*/ | 208 | /*look for any elements with the class "custom-select":*/ | ... | ... |
-
Please register or login to post a comment