Two linkage, for example: The selection urban provinces

The effect is as follows:

js code

<Script type = "text / JavaScript">
         var Array = [[ "- Select -"], [ "Haidian District", "Chaoyang District", "Shihchingshan zone", "area Changping"], [ "Qingdao City, "" Jinan City, "" Tai'an City, "" Liaocheng "], [" Zhengzhou City, "" Nanyang City, "" Anyang City, "" Zhumadian "], [" Shijiazhuang "," Langfang "" Changzhou, "" imitate "], [" Xi "," Xianyang "," common ground " ]]; 
        
        function SEL (select) { 
            
            var optionIndex = select.selectedIndex;
             var Options = Array [optionIndex]; 
                       
            // Get two select Object 
            var selectTwo = document.getElementById ( "TWO" ); 
            
            // put option to empty the current SELECT 
            selectTwo.options.length=0;

            for (var index in options) {
                var optionObj = document.createElement("option");
                optionObj.innerHTML=options[index];
                selectTwo.appendChild(optionObj);
            }
                      
        }
               
    </script>

 

 

1  < the SELECT onChange = "SEL (the this)" > 
2              < the Option > - Please select - </ the Option > 
3              < the Option > Beijing </ the Option > 
4              < the Option > Shandong Province </ the Option > 
5              < the Option > Henan </ Option > 
. 6              < Option > Hebei </ Option > 
. 7              < Option > Shanxi </option>
 8         </select>
 9         
10         
11         <select id="two">
12                    
13         </select>

 

Guess you like

Origin www.cnblogs.com/hhhwj/p/11262799.html
Recommended