< html > < head >< title > 联动菜单 </ title ></ head > < script type = ' text/javascript ' > var city = [ [ ' 三明 ' , ' 厦门 ' , ' 福州 ' ], [ ' 南丰 ' , ' 南昌 ' , ' 上饶 ' ], [ ' 温州 ' , ' 金华 ' , ' 杭州 ' ] ] function getCity() ... { var provinceValue = document.forms['theForm'].elements['province'].value; if(provinceValue==0) ...{ return; }; var provinceF = document.forms['theForm'].elements["province"]; var cityF = document.forms['theForm'].elements['city']; var provinceCity = city[provinceF.selectedIndex-1]; cityF.length=1; alert(provinceCity.length); for(var i=0;i<provinceCity.length;i++) ...{ cityF[i+1]=new Option(provinceCity[i],provinceCity[i]) } } </ script > < body > < form id = ' theForm ' > < select name = ' province ' onchange = ' getCity() ' > < option value = ' 0 ' > 请选择省份 </ option > < option value = ' 福建 ' > 福建 </ option > < option value = ' 江西 ' > 江西 </ option > < option value = ' 浙江 ' > 浙江 </ option > </ select > < select name = ' city ' > < option value = ' 0 ' > 请选择城市 </ option > </ select > </ form > < body > </ html >