<body> <select id="s1"><option>-请选择-</option></select> <select id="s2"><option>-请选择-</option></select> <select id="s3"><option>-请选择-</option></select> <script> var arr1=["黑龙江省",'吉林省','北京']; var arr2=[ ['哈尔滨','讷河','黑河'], ['长春','吉林市','白城'], ['海淀区','朝阳区','房山'] ]; var arr3=[ [['香房','动力','道里'],['讷河1','讷河2','讷河3'],['黑河1','黑河2','黑河3']], [['长春1','长春2','长春3'],['吉林市1','吉林市2','吉林市3'],['白城1','白城2','白城3']], [['海淀区1','海淀区1','海淀区1'],['朝阳区1','朝阳区1','朝阳区1'],['房山1','房山2','房山3']], ]; function $(id){ return document.getElementById(id); }function superMan(arr,ele){for(var i=0;i<arr.length;i++ ){ var option=document.createElement('option'); option.innerHTML=arr[i]; option.value=i; ele.appendChild(option); } }window.onload=function (){ var s1=$('s1'); s1.onchange=changeCity; while(s1.children.length>1){ s1.removeChild(s1.lastElementChild); } superMan(arr1,s1);} var n=null;//索引function changeCity(){ var s2=$('s2'); s2.onchange=changeQu; while(s2.children.length>1){ s2.removeChild(s2.lastElementChild); } n=this.value;//索引 var ar=arr2[n]; superMan(ar,s2);}function changeQu(){ var s3=$('s3'); while(s3.children.length>1){ s3.removeChild(s3.lastElementChild); } var arrr=arr3[n][this.value]; console.log(arrr); superMan(arrr,s3);}</script> </body>我想知道var arrr=arr3[n][this.value];的含义,以及各个步骤的大概意思
添加回答
举报
0/150
提交
取消