ホームページ > 記事 > ウェブフロントエンド > カスケード問題、解決してください! ! ! _html/css_WEB-ITnose
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <title>MyHtml.html</title> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="this is my page"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <!--<link rel="stylesheet" type="text/css" href="./styles.css">--> </head> <script type="text/javascript"> function selectshi(sheng){ var s = sheng.value; var shi = document.getElementById("shi"); if(s == 'initial'){ shi.innerHTML = '<option>请选择市</option>'; }else if(s == 'bj'){ shi.innerHTML = '<option>朝阳区</option><option>海淀区</option>'; }else if(s == 'hb'){ shi.innerHTML = '<option>石家庄</option><option>张家界</option><option>保定</option>'; }else if(s == 'ln'){ shi.innerHTML = '<option>沈阳</option><option>大连</option><option>营口</option>'; }else if(s == 'hn'){ shi.innerHTML = '<option>郑州</option><option>洛阳</option><option>焦作</option>'; }else if(s == 'js'){ shi.innerHTML = '<option>南京</option><option>徐州</option><option>苏州</option>'; } } </script> <body> <select id="sheng" onchange="selectshi(this)"> <option value="initial">请选择省</option> <option value="bj">北京市</option> <option value="sd">山东省</option> <option value="hb">河北省</option> <option value="ln">辽宁省</option> <option value="hn">河南省</option> <option value="js">江苏省</option> </select> <select id="shi"> <option>请选择市</option> </select><br> </body></html>
var obj=document.getElementById("shi");
obj. .length=0;
var s = sheng.value;
if(s == 'initial'){
obj.options.add(new Option('都市を選択してください','')); s=='bj'){
obj.options.add(new Option('朝陽区','cy'))
obj.options.add(new Option('海淀区','hd')) ;
}else if(s==hb){
obj.options.add(new Option('石家荘','sjz'));
obj.options.add(new Option('張家界','zjj') ) ;
}else if(s=='ln'){
.....
}
}
または:
function selectshi(sheng){
var s = sheng.value;
var addshi="1bc555836111ef3da6c8757ad7eb2bbe"
if(s == 'initial'){
addshi = addshi+'4afa15d3069109ac30911f04c56f3338' }else if(s = = 'hb'){ se if(s = = 'ln'){ if(s = = 'hn'){
// ......
}
document.getElementById(" addshi").innerHTML=addshi+"18bb6ffaf0152bbe49cd8a3620346341"
} ; 北京4afa15d3069109ac30911f04c56f3338 5f08f1f33c3dee93c105e53168fbce87遼寧省4afa15d3069109ac30911f04c56f3338 <