1功能预览
2HTML代码
<span> <tr> <td> <img onclick = "addtype()" src = "$ {msurl}/images/logo/add.png">产品范围:</td> <td> <select id = "selecttypeone" data-options = " data-options = "必須:true"> <option selected = "selected">全部</option> </select> </td> </tr> <tr> <td> </td> <td id = "typethree"> </td> </tr> <tr> <td> </td> <td> <SPAS ID = "Typeoneresult" id = "typeonesubresult"> </span> <hr/> </td> </tr> </span>3JS代码
$( '#selecttypeone')。combobox({url:config.urlmap.typelist、valuefield: 'name'、textfield: 'name'、exiceber:true、width: '100'、onselect:function(row){typename1 = row.name $( '#typethree')。 $( '#typeonesubresult')。html( ""); + ">" + row.name; $ .getjson(config.urlmap.typelist + "?low.id、function(data){var i = 0; i <data.length; i ++){typethreename + =" <input onclinktype value = " + data [i] .name +" type = 'checkbox'> " + data [i] .name} $( '#typethree')。html(typethreename); $( '#typeoneresult')。 })}}); })//删除下标元素方式一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.leng.prototytotype.baoremove = function(dx){if(dx){dx){dx> 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( "、")); }