eventBind:function(){var that =this;//第一個下拉選單的父id為約定好的值var data = that.intiSelect('0');//console.log(data);//列印通過intiSelect方法獲取的資料var tempHtml ="<option value=\"\">請選擇</option>";if(data !=null&& data !=""){for(var i =0; i < data.length; i++){
tempHtml +="<option value=\""+data[i].dropDownCode+"\">"+data[i].dropDownName+"</option>";}}//為第一個下拉選單新增html元素$("select[name='one']").html(tempHtml);//新增select的change事件$("select[name='one']").unbind('change').change(function(){//觸發第二個下拉選單的change事件,達到級聯的效果
that.secondChange($("select[name='one']").val(),'two','three','four');});});},
secondChange:function(parentCode,name,sonName,sunzi){var that =this;$("select[name='"+name+"']").unbind('change').change(function(){//console.log("threeChange");
that.threeChange($("select[name='"+name+"']").val(),sonName,sunzi);});if(""== parentCode){//清空$("select[name='"+name+"']").html("");}else{var data =this.intiSelect(parentCode);var tempHtml ="<option value=\"\">請選擇</option>";if(data !=null&& data !=""){for(var i =0; i < data.length; i++){
tempHtml +="<option value=\""+data[i].dropDownCode+"\">"+data[i].dropDownName+"</option>";}}$("select[name='"+name+"']").html(tempHtml);}}