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

首頁 > 編程 > JavaScript > 正文

JS 實現列表與多選框選擇附預覽動畫

2019-11-20 13:58:58
字體:
來源:轉載
供稿:網友

1功能預覽

2html代碼

<span> <tr> <td><img onclick="addType()" src="${msUrl}/images/logo/add.png">產品范圍:</td> <td><select id="selectTypeOne" class="easyui-combobox" data-options="required:true"> <option>一級分類</option> </select> <select id="selectTypeTwo" class="easyui-combobox" data-options="required:true"> <option selected="selected">全部</option> </select></td> </tr> <tr height="20px"> <td></td> <td id="typeThree"></td> </tr> <tr height="30px"> <td></td> <td><span id="typeOneResult"></span><span id="typeOneSubResult"></span> <hr /></td> </tr> </span>

 3js代碼

$('#selectTypeOne').combobox({ url : config.urlMap.typeList, valueField : 'name', textField : 'name', required : true, width : '100', onSelect : function(row) { typeName1 = row.name $('#typeThree').html(""); $('#typeOneResult').html(""); $('#typeOneSubResult').html(""); subTypeName=[]; $('#selectTypeTwo').combobox({ url : config.urlMap.typeList + "?parent=" + row.id, valueField : 'name', textField : 'name', width : '100', required : true, onSelect : function(row) { typeName2 = typeName1 + ">" + row.name; $.getJSON(config.urlMap.typeList + "?parent=" + row.id, function(data) { var typeThreeName = "" for (var i = 0; i < data.length; i++) { typeThreeName += "<input onclick=clinkType(/"" + data[i].name + "/") name='typeThree' value=" + data[i].name + " type='checkbox'>" + data[i].name } $('#typeThree').html(typeThreeName); $('#typeOneResult').html(typeName2 + ">"); $('#typeOneSubResult').html(""); subTypeName=[]; }); } }) } }); }) //刪除下標元素方式一 Array.prototype.remove = function(dx) { if (isNaN(dx) || dx > this.length) { return false; } for (var i = 0, n = 0; i < this.length; i++) { if (this[i] != this[dx]) { this[n++] = this[i] } } this.length -= 1 } //刪除數組元素方式二 Array.prototype.baoremove = function(dx) { if (isNaN(dx) || dx > this.length) { return false; } this.splice(dx, 1); } var subTypeName = []; function clinkType(name) { var index = subTypeName.indexOf(name) if (index == -1) { subTypeName.push(name); } else { subTypeName.baoremove(index); } $('#typeOneSubResult').html(subTypeName.join(",")); }
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 三都| 满洲里市| 禹州市| 麻阳| 孝昌县| 巨野县| 蓬莱市| 黄平县| 闸北区| 会泽县| 周口市| 金塔县| 屏东市| 河源市| 合山市| 偃师市| 方城县| 竹溪县| 姜堰市| 二连浩特市| 宾川县| 正宁县| 十堰市| 英吉沙县| 楚雄市| 洞头县| 永川市| 霞浦县| 尼勒克县| 东阿县| 芮城县| 江西省| 沾化县| 崇阳县| 南平市| 远安县| 元江| 蒙城县| 贵定县| 寿阳县| 鹤山市|