function linkQ(sel1,sel2,sel3,arr){    var sel1v=$.map(arr,function(val,key){return key})    // 将sel1的option放入    $.each(arr,function(i,n){        sel1.append("
"+ n.provinceName +"")    })    // 将sel1第一项对应sel2的option放入    // sel1 change事件开始联动 3级联动    if(arguments.length==4){        sel1.on('change',function(){            sel2.html("");            sel2.append("
-请选择-");            sel3.html("");            sel3.append("
-请选择-");            var index=sel1.get(0).selectedIndex-1;            if(index<0){index=0};            var sel2v=$.map(arr[sel1v[index]].cities,function(val,key){return key})            $.each(sel2v,function(i, n){                sel2.append("
"+ arr[sel1v[index]].cities[n].cityName +"")            })        })        sel2.on('change',function(){            sel3.html("");            sel3.append("
-请选择-");            var index2=sel2.get(0).selectedIndex-1;            var index=sel1.get(0).selectedIndex-1;            if(index<0){index=0};            if(index2<0){index2=0};            var sel2v=$.map(arr[sel1v[index]].cities,function(val,key){return key});            var ans=arr[sel1v[index]].cities[sel2v[index2]].dealers;            $.each(ans,function(i, n){                sel3.append("
"+ n.dealerName +"")            })        })    }}linkQ($("#p1"),$("#c1"),$("#d1"),arrJson);