标签:har node hang var title ext length span log
document.createElement("标签名");
document.removeChild("去掉某个标签");
document.appendChild("添加标签");
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script type="text/javascript"> function showCitys(){ var allCity = [[],["广州","深圳"],["南宁","桂林","我不住地"]]; var allProvice = document.getElementById("allProvice"); //获取选择的省份 var i = parseInt(allProvice.selectedIndex); //取出这个省份中的城市 var data = allCity[i]; //填入到 var citys = document.getElementById("citys"); citys.options.length = 1; var optionNode = document.createElement("option"); for(var i = 0 ; i < data.length ; i++){ var optionNode = document.createElement("option"); optionNode.innerHTML = data[i]; citys.appendChild(optionNode); } } </script> <title></title> </head> <body> 省份 <select name="" id="allProvice" onchange="showCitys()"> <option value="">省份</option> <option value="">广东</option> <option value="">广西</option> </select> 城市 <select name="" id="citys" > <option>城市</option> </select> </body> </html>
标签:har node hang var title ext length span log
原文地址:http://www.cnblogs.com/bequt/p/6280419.html