1 var arr = {
2 厂商1: {
3 'a':'b,d,f','c':'d','e':'f'
4 },
5 厂商2: {
6
7 },
8 厂商3: {
9 3:1,3:2,3:3
10 }
11 }
12 function ht(obj){
13 $(obj).show();
14 $(obj).html('<option>请选择</option>')
15 }
16 $.each(arr,function(data) {
17 $('.se1').append('<option>'+data+'</option>');
18 });
19 $('.se1').bind('change',function(){
20 ht($('.se2'));
21 $.each(arr,function(data,data2){
22 if($('.se1 option:selected').text() == data){
23 $.each(data2,function(pt,pc){
24 $('.se2').append('<option>'+pt+'</option>');
25 });
26 $('.se2').change(function(){
27 ht($('.se3'));
28 $.each(data2,function(pt,pc){
29 if($('.se2 option:selected').text() == pt){
30 // console.log(pc);
31 $.each(pc.split(','),function(pt,pc){
32 console.log(this)
33 $('.se3').append('<option>'+this+'</option>');
34 });
35 }
36 })
37 })
38 }
39 })
40 })