日期:2014-05-16  浏览次数:20328 次

js 下拉框级联
<!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>
	<BODY>
		<form id="ztga" name="ztga">
			<font class="label" style="color: #545454;">选择疾病:</font>
			<br>
			<font class="label" style="color: #545454;">&nbsp;&nbsp;大类:</font>
			<select id="infectionType" name="infectionType" style="width: 120"
				onchange="cascadeChange(this.value)">
				<option value="1" selected="selected">
					=请选择=
				</option>
				<option value="2">
					法定传染病
				</option>
				<option value="3">
					其他传染病
				</option>
				<option value="4">
					突发事件
				</option>
			</select>
			<br>
			<font class="label" style="color: #545440;">&nbsp;&nbsp;小类:</font>
			<select name="lb" id="lb" style="width: 120">
				<option selected="selected">
					=请选择=
				</option>
			</select>
		</form>
	</body>
</HTML>
<script language="javascript" type="text/javascript"> 
		function cascadeChange(s){ 
				switch (s){
				   case "2" : 
				       document.getElementById("lb").options.length=0; 
				       var soojsvalue=[0,1,2,3,4,5,6,7,8,9,10,11,12]; 
				   	   var soojs_text=["鼠疫","霍乱","传染性非典","艾滋病","HIV","甲肝","乙肝","丙肝","戊肝","肝炎(未分型)","痢疾","细菌性痢疾","登革热"]; 
				       for (var i=0;i<soojs_value.length;i++){ 
				       var oOption = document.createElement("OPTION");   
				       oOption.value=soojs_value[i];   
				       oOption.text=soojs_text[i];   
				       ztga.lb.options.add(oOption); 
				     }break; 
				   case "3" : 
				       document.getElementById("lb").options.length=0; 
				       var soojsvalue=[0,1,2,3,4,5,6,7,8,9]; 
				       var soojs_text=["非淋菌性尿道炎","尖锐湿疣","水痘","肝吸虫病","恙虫病","森林脑炎","不明原因肺炎","结核性胸膜炎","人感染猪流菌","其他"]; 
				       for ( var i=0;i<soojs_value.length;i++){ 
				       var oOption  = document.createElement("OPTION");   
				       oOption.value=soojs_value[i];   
				       oOption.text=soojs_text[i];   
				       ztga.lb.options.add(oOption); 
				     }break; 
				    case "4": 
				       document.getElementById("lb").options.length=0; 
				       var soojsvalue=[0,1,2,3,4,5,6,7,8,9,10,11,12]; 
				       var soojs_text=["甲类传染病","乙类传染病","丙类传染病","其他传染病","动物性食物中毒","植物性食物中毒","不明食物中毒","农药中毒","空气污染","水污染","土壤污染","群体性不明原因痢疾","医院内感染"]; 
				       for (var i=0;i<soojs_value.length;i++){ 
				       var oOption = document.createElement("OPTION");   
				       oOption.value=soojs_value[i];   
				       oOption.text=soojs_text[i];   
				       ztga.lb.options.add(oOption); 
				     } break;    
				default : 
				      document.getElementById("lb").options.length=0; 
				      var  oOption = document.createElement("OPTION"); 
				      oOption.value=0;   
				      oOption.text="=请选择="; 
				      ztga.lb.options.add(oOption); 
				} 
		} 
</script>

?