/home/mjc1/public_html/onlinecs/mobile/postcode_doro.php


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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
<?
include_once("./_common.php");
include(
"./header.php"); 
include(
"./commonST.php");

if(!isset(
$_GET['uid'])) $_GET['uid'] = "";
if(!isset(
$_GET['detail'])) $_GET['detail'] = "";
if(!isset(
$_GET['txtdate'])) $_GET['txtdate'] = "";
if(!isset(
$_GET['txtdate2'])) $_GET['txtdate2'] = "";
if(!isset(
$_GET['new'])) $_GET['new'] = "";
?>

<script>
function addressSubmit(){
var addressValue = document.getElementById("address").value;
    if(addressValue == ""){
        alert("주소를 선택하세요");
        return;        
    }
    var url = "./buyWrite_order.php?uid=<?=$_GET['uid']?>&detail=<?=$_GET['detail']?>&txtdate=<?=$_GET['txtdate']?>&txtdate2=<?=$_GET['txtdate2']?>&new=<?=$_GET['new']?>&addressValue="+addressValue;
    location.replace(url);
}
</script>
        <div class="snb">
            <p class="txt">주소검색 <span class="f11 blue">간편한 우편번호 찾기입니다.</span></p>
        </div>


        <div class="addrBtn">
            <ul>
                <li>
                    <a href="postcode.php?uid=<?=$_GET['uid']?>&detail=<?=$_GET['detail']?>&txtdate=<?=$_GET['txtdate']?>&txtdate2=<?=$_GET['txtdate2']?>&new=<?=$_GET['new']?>"><div class="b_off">(구)지번주소</div></a>
                </li>            
                <li>
                    <a href="postcode_doro.php?uid=<?=$_GET['uid']?>&detail=<?=$_GET['detail']?>&txtdate=<?=$_GET['txtdate']?>&txtdate2=<?=$_GET['txtdate2']?>&new=<?=$_GET['new']?>"><div class="b_on">도로명주소</div></a>
                </li>
            </ul>
        </div><!-- class=addrContents -->


        <span id='aaa' style='display:block;'>
            <div class="addrContents">

                <form name='searchFrm' id="searchFrm" method="post">
                <div class="postSearch">
                    <div class="books_carry">
                        <dl class="wr1">
                            <dt><label>시/도</label></dt>
                            <dd>
                            <table>
                                <colgroup><col class="cw1"><col class="cw2"></colgroup>
                                <tbody>
                                <tr>                                
                                    <td>
                                        <select title="전체" name="sido" id="sido" onchange="setComboBox(this)">
                                            <option value=''>선택</option>
                                            <option value='서울특별시'>서울특별시</option>
                                            <option value='경기도'>경기도</option>
                                            <option value='인천광역시'>인천광역시</option>
                                            <option value='부산광역시'>부산광역시</option>
                                            <option value='대전광역시'>대전광역시</option>
                                            <option value='광주광역시'>광주광역시</option>
                                            <option value='대구광역시'>대구광역시</option>
                                            <option value='울산광역시'>울산광역시</option>
                                            <option value='강원도'>강원도</option>
                                            <option value='경상남도'>경상남도</option>
                                            <option value='경상북도'>경상북도</option>
                                            <option value='전라남도'>전라남도</option>
                                            <option value='전라북도'>전라북도</option>
                                            <option value='충청남도'>충청남도</option>
                                            <option value='충청북도'>충청북도</option>
                                            <option value='제주특별자치도'>제주특별자치도</option>
                                            <option value='세종특별자치시'>세종특별자치시</option>
                                        </select>
                                    </td>
                                    <td class="cw_text">
                                        <span>구/군</span>
                                    </td>
                                    <td>
                                        <select title="전체" name="gugun" id="gugun">
                                            <option value=''>선택</option>
                                        </select>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                            </dd>                    
                        </dl>

                        <dl class="wr1">
                            <dt><label>건물번호</label></dt>
                            <dd>
                                <table>
                                    <colgroup><col class="45%"><col class="10%"><col class="45%"></colgroup>
                                    <tbody>
                                    <tr>
                                        <td>
                                            <input type="text" name="d_buildingNo1" id="d_buildingNo1" maxlength="20" class="it">
                                        </td>
                                        <td class="cw_text">
                                            <span style="text-align:center;"> - </span>
                                        </td>
                                        <td>
                                            <input type="text" name="d_buildingNo2" id="d_buildingNo2" maxlength="20" class="it">
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </dd>
                        </dl>    

                        <dl class="wr1">
                            <dt><label>도로명</label></dt>
                            <dd>
                                <input type="text" name="d_road" id="d_road" maxlength="100" placeholder="도로명을 입력하세요." class="it">
                            </dd>
                        </dl>    

                        <dl class="wr1">
                            <dt class="screen_out"><label>저장, 취소 버튼입니다.</label></dt>
                            <dd>
                                <ul class="btn_total">
                                    <li class="b_gray"><a href="javascript:chgpass();"><div>검 색</div></a></li>
                                    <li style="width:5px;"></li>
                                    <li class="b_blue"><a href="javascript:addressSubmit();"><div>선 택</div></a></li>
                                    <li style="width:5px;"></li>
                                    <li class="b_defn"><a href="javascript:location.replace('index.php');"><div>취 소</div></a></li>
                                </ul>
                            </dd>
                        </dl>

                        <p class="postcodeText">아래 주소를 선택하시고 <strong>[선택]</strong>버튼을 누르세요.</p>

                    </div><!-- <div class="books_carry"> -->
                </div><!-- <div class="pwd_section"> -->
                <!-- id="searchFrm" -->
                
                <div class="list">
                    <h2>주소내역</h2>
                    <div class="books_carry">
                        <select name="address" id="address" style='width:100%; height:50%;' size='6'>
                        </select>
                    </div>
                </div><!-- id="list" -->
            <span> 
            <!-- 지번주소 끝 -->
            </form>


        </div><!-- <div class="addrContainer"> -->

<script>
function setComboBox(o) {
    var code = o.value;
    //var div    = $(o).parent();                        // 셀렉트박스의 상위객체
    var div    = $(".books_carry");                        // 셀렉트박스의 상위객체    
    var cnt = $('select', div).size();                    // 셀렉트박스의 갯수
    var idx = $('select', div).index(o);                // 현재 셀렉트 박스의 순서
    var depth = cnt -1 + idx;
    var combo = $('select', div).eq(idx+1);
    var text = '<option value="">구/군</option>';
    var text2 = '<option value="">전체</option>';

    if(code == ''){                                        // 전체를 선택했을 경우
        $('select:gt('+ idx +')', div).html(text);
        return;
    }
    if(code == '세종특별자치시'){                            // 세종시를 선택했을 경우
        $('select:gt('+ idx +')', div).html(text2);
        return;
    }    
    
    if(code != '세종특별자치시'){
        $.post('./postAjaxDoro.php',{code:code,idx:idx+1}, function(rst) {
            var sel1 = $.trim(rst).split(/\n/);
            
            $('select:gt('+idx+')',div).html(text);
            // 데이터값이없으면..
            if (sel1 == '') {
                alert('데이터가 존재하지 않습니다.');
                return false;
            }
            for(var k in sel1) {
                var tmp = sel1[k].split(/\|/);
                combo.append('<option value="'+tmp[0]+'">' + tmp[1] + '</option>');
            }
        });        
    }
}
        
function chgpass() {
    var sido             = document.getElementById("sido").value;
    var gugun             = document.getElementById("gugun").value;
    var d_buildingNo1     = document.getElementById("d_buildingNo1").value;
    var d_buildingNo2     = document.getElementById("d_buildingNo2").value;
    var d_road             = document.getElementById("d_road").value;
    
    if(sido == ''){
        alert('시/도를 선택하세요');
        return;
    }
    if(gugun == ''){
        alert('구/군을 선택하세요');
        return;
    }
    if(d_road == ''){
        alert('도로명을 두글자 이상 입력하세요');
        return;
    }
    if(d_road.length < 2){
        alert('도로명을 두글자 이상 입력하세요');
        return;
    }            
    
    var div    = $(".list");                                    // 셀렉트박스의 상위객체
    var idx = 0;
    var cnt = $('select', div).size();                        // 셀렉트박스의 갯수
    var depth = cnt -1 + idx;
    var combo = $('select', div).eq(idx);
    var text = '<option value="">주소</option>';
    
    /*
    if(code == ''){                                            // 전체를 선택했을 경우
        $('select:gt('+ idx +')', div).html(text);
        return;
    }
    */
    document.getElementById("address").options.length = 0;  //모두삭제
    
    $.post('./postAjaxDoro2.php',{sido:sido,gugun:gugun,d_buildingNo1:d_buildingNo1,d_buildingNo2:d_buildingNo2,d_road:d_road,idx:idx}, function(rst) {
        var sel1 = $.trim(rst).split(/\n/);
        
        $('select:gt('+idx+')',div).html(text);
        // 데이터값이없으면..
        if (sel1 == '') {
            alert('데이터가 존재하지 않습니다.');
            return false;
        }
        for(var k in sel1) {
            var tmp = sel1[k].split(/\|/);
            combo.append('<option value="'+tmp[0]+'">' + tmp[1] + '</option>');
        }
    });
}        
</script>


<? include("./footer.php"); ?>



<!-- <table>
    <caption>주소 조회 내역입니다.</caption>
    <colgroup>
        <col width="12%"><col width="12%"><col width="12%">
        <col width="16%"><col width="12%"><col width="12%">
        <col width="12%"><col width="12%">
    </colgroup>
    <thead>
        <tr>
            <th>우편번호</th>
            <th>시/도</th>
            <th>구/군</th>
            <th>읍/면</th>
        <tr>
        </tr>
            <th>도로명</th>
            <th>건물본번</th>
            <th>건물부번</th>
            <th>다량배달처</th>
        </tr>
    </thead>

    <tbody>
        <tr>
            <th colspan="8" bgcolor="#5076a9" style="height:3px;"></th>
        </tr>
        
        <tr>
            <td>706-032</td>
            <td>대구광역시</td>
            <td>수성구</td>
            <td></td>
        <tr>
        </tr>
            <td>들안로</td>
            <td>235</td>
            <td>0</td>
            <td></td>
        </tr>

    </tbody>
</table> -->