国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Java > 正文

java json 省市級聯實例代碼

2019-11-26 15:58:04
字體:
來源:轉載
供稿:網友

復制代碼 代碼如下:

//     獲取國家省市區信息
$(document).ready(function(){

//從程序獲取json格式的數據
var info = $request.getAttribute("manualOrderAreaInfo");


var provinceInfo = $("#provinceId");
var cityId = $("#cityId");

//清空信息
provinceInfo.empty();

//循環獲取信息
$.each(info.area, function(idx,item){
if(idx == 0){
return true;
}
//alert("name:"+idx+",areaId:"+item.areaId+",areaName:"+item.areaName+",areaParentId:"+item.parentId);

//這里父類ID為1是城市信息
if(item.parentId == 1){
$("<option value="+item.areaId+">"+item.areaName+"</option>").appendTo(provinceInfo);
}
});
//獲取對應的城市信息
$("#provinceId").change(function(){
var tempInfo = $("#provinceId").val();
cityId.empty();
$.each(info.area, function(indexInfo,item){
if(indexInfo == 0){
return true;
}
if(item.parentId == tempInfo){
$("<option value="+item.areaId+">"+item.areaName+"</option>").appendTo(cityId);
}
});
});
});

復制代碼 代碼如下:

<tr>
                    <th style="width:120px;">收貨人省份</th>
<!--                    <td style="width:270px;"><input type="text" value="$!{manualEntryOrder.goodReceiverProvince}" name="manualEntryOrder.goodReceiverProvince" style="width:150px;"  maxlength="255"/></td>-->
                        <td style="width: 270px;">
                            <select id="provinceId" name="staffProvince" style="width: 154px;">
                            </select>

                        </td>
                    <th style="width:140px;">收貨人城市</th>
                    <td style="width:270px;">
<!--                        <input type="text" value="$!{manualEntryOrder.goodReceiverCity}" name="manualEntryOrder.goodReceiverCity" style="width:150px;"  maxlength="255"/>-->
                            <select id="cityId" name="staffProvince" style="width: 154px;">
                                <option value="--">---請選擇城市信息---</option>
                            </select>
                    </td>
                </tr>

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 叙永县| 应用必备| 遂川县| 白城市| 华容县| 永善县| 唐河县| 安乡县| 梅州市| 徐水县| 留坝县| 斗六市| 镇巴县| 晴隆县| 玉林市| 大安市| 仪征市| 武宁县| 彭山县| 治多县| 榆社县| 南安市| 邓州市| 金塔县| 江城| 海晏县| 页游| 禹城市| 新余市| 三穗县| 广东省| 阳新县| 侯马市| 忻城县| 犍为县| 乐至县| 崇阳县| 枣庄市| 建瓯市| 鹤庆县| 柞水县|