Ignore:
Timestamp:
2009/10/30 19:40:52 (17 years ago)
Author:
satou
Message:

#561 住所検索の非ポップアップ化(jQuery×AJAX)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/comu-ver2/html/user_data/packages/default/js/site.js

    r18257 r18357  
    3636// 郵便番号入力呼び出し. 
    3737function fnCallAddress(php_url, tagname1, tagname2, input1, input2) { 
    38     zip1 = document.form1[tagname1].value; 
    39     zip2 = document.form1[tagname2].value; 
    40      
    41     if(zip1.length == 3 && zip2.length == 4) { 
    42         url = php_url + "?zip1=" + zip1 + "&zip2=" + zip2 + "&input1=" + input1 + "&input2=" + input2; 
    43         window.open(url,"nomenu","width=500,height=350,scrollbars=yes,resizable=yes,toolbar=no,location=no,directories=no,status=no"); 
    44     } else { 
    45         alert("郵便番号を正しく入力して下さい。"); 
     38    zip1 = document.form1[tagname1].value; 
     39    zip2 = document.form1[tagname2].value; 
     40 
     41    if(zip1.length == 3 && zip2.length == 4) { 
     42        $.get( 
     43            php_url, 
     44            {zip1: zip1, zip2: zip2, input1: input1, input2: input2}, 
     45            function(data) { 
     46                arrdata = data.split("|"); 
     47                if (arrdata.length > 1) { 
     48                    fnPutAddress(input1, input2, arrdata[0], arrdata[1], arrdata[2]); 
     49                } else { 
     50                    alert(data); 
     51                } 
     52            } 
     53        ); 
     54    } else { 
     55        alert("郵便番号を正しく入力して下さい。"); 
    4656    } 
    4757} 
    4858 
    4959// 郵便番号から検索した住所を渡す. 
    50 function fnPutAddress(input1, input2) { 
    51     // 親ウィンドウの存在確認。. 
    52     if(fnIsopener()) { 
    53         if(document.form1['state'].value != "") { 
    54             // 項目に値を入力する. 
    55             state_id = document.form1['state'].value; 
    56             town = document.form1['city'].value + document.form1['town'].value; 
    57             window.opener.document.form1[input1].selectedIndex = state_id; 
    58             window.opener.document.form1[input2].value = town; 
    59         } 
    60     } else { 
    61         window.close(); 
    62     }        
     60function fnPutAddress(input1, input2, state, city, town) { 
     61    if(state != "") { 
     62        // 項目に値を入力する. 
     63        document.form1[input1].selectedIndex = state; 
     64        document.form1[input2].value = city + town; 
     65    } 
    6366} 
    6467 
     
    7982// セレクトボックスに項目を割り当てる. 
    8083function fnSetSelect(name1, name2, val) { 
    81     sele1 = document.form1[name1];  
     84    sele1 = document.form1[name1]; 
    8285    sele2 = document.form1[name2]; 
    83      
     86 
    8487    if(sele1 && sele2) { 
    8588        index=sele1.selectedIndex; 
    86          
    87         // セレクトボックスのクリア  
     89 
     90        // セレクトボックスのクリア 
    8891        count=sele2.options.length 
    8992        for(i = count; i >= 0; i--) { 
    9093            sele2.options[i]=null; 
    9194        } 
    92          
     95 
    9396        // セレクトボックスに値を割り当てる。 
    9497        len = lists[index].length 
     
    163166            return; 
    164167        } 
    165         break;       
     168        break; 
    166169    default: 
    167170        break; 
     
    214217                        'use_point' 
    215218                        ); 
    216      
     219 
    217220        if(!document.form1['point_check'][0].checked) { 
    218221            color = "#dddddd"; 
     
    222225            flag = false; 
    223226        } 
    224          
     227 
    225228        len = list.length 
    226229        for(i = 0; i < len; i++) { 
     
    253256                        'deliv_tel03' 
    254257                        ); 
    255      
     258 
    256259        if(!document.form1['deliv_check'].checked) { 
    257260            fnChangeDisabled(list, '#dddddd'); 
     
    286289function fnChangeDisabled(list, color) { 
    287290    len = list.length; 
    288      
     291 
    289292    for(i = 0; i < len; i++) { 
    290293        if(document.form1[list[i]]) { 
     
    297300                document.form1[list[i]].disabled = true; 
    298301                g_savecolor[list[i]] = document.form1[list[i]].style.backgroundColor; 
    299                 document.form1[list[i]].style.backgroundColor = color;//"#f0f0f0";   
    300             }            
     302                document.form1[list[i]].style.backgroundColor = color;//"#f0f0f0"; 
     303            } 
    301304        } 
    302305    } 
     
    307310function fnCheckLogin(formname) { 
    308311    var lstitem = new Array(); 
    309      
     312 
    310313    if(formname == 'login_mypage'){ 
    311314    lstitem[0] = 'mypage_login_email'; 
     
    318321    var errflg = false; 
    319322    var cnt = 0; 
    320      
     323 
    321324    // 必須項目のチェック 
    322325    for(cnt = 0; cnt < max; cnt++) { 
     
    326329        } 
    327330    } 
    328      
    329     // 必須項目が入力されていない場合   
     331 
     332    // 必須項目が入力されていない場合 
    330333    if(errflg == true) { 
    331334        alert('メールアドレス/パスワードを入力して下さい。'); 
     
    333336    } 
    334337} 
    335      
     338 
    336339// 時間の計測. 
    337340function fnPassTime(){ 
     
    349352    } else { 
    350353        window.close(); 
    351     }        
     354    } 
    352355} 
    353356 
     
    371374// テキストエリアのサイズを変更する. 
    372375function ChangeSize(button, TextArea, Max, Min, row_tmp){ 
    373      
     376 
    374377    if(TextArea.rows <= Min){ 
    375378        TextArea.rows=Max; button.value="小さくする"; row_tmp.value=Max; 
Note: See TracChangeset for help on using the changeset viewer.