1 功能预览
2html 代码
<pan> <tr> <td> <img onclick = "addtype ()" src = "$ {msurl}/images/logo/add.png"> 产品范围 : </td> <td> <select id = "selectTypeone"> 产品范围 hude: true "> <partice> 一级分类 antain> </select> <select> <select>" select> "select>" select> "select>» data-options = "требуется: true"> <option selected = "selected"> 全部 </option> </select> </td> </tr> <tr> <td> </td> <td id = "typethree"> </td> </tr> <tr> <td> </td> <td> <pan = " id = "typeonesubresult"> </span> <hr/> </td> </tr> </span>3JS 代码
$ ('#selectTypeOne'). ComboBox ({url: config.urlmap.typelist, valuefield: «Имя», Textfield: «Имя», требуется: true, width: '100', onselect: function (row) {typename1 = row.name $ ('#typethree'). $ ('#TypeOnesubResult'). Html (""); + ">" + row.name; value = " + data [i] .name +" type = 'fackbox'> " + data [i] .name} $ ('#typethrete'). html (typethereName); $ ('#typeneresult'). html (typename2 +"> "); })}}); }) // 删除下标元素方式一 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) {ifnan (dx) | } 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 (",")); }