日期:2014-05-17  浏览次数:20685 次

jquery读单选框问题
界面上有radio表单:A,B,C
选A的时候自动出现一个下拉列表,内容为A1,A2,A3;
选B同样如此,内容为B1,B2,B3
选C也是如此,C1,C2,C3。

用jquery可以实现吗?求例子,谢谢

------解决方案--------------------

<body onload="func()"> 
<form name="frm">
<input type="radio" checked id="AA" name="radio" value="A" onclick="fun()"/>A 
<input type="radio" id="BB" name="radio" value="B" onclick="fun()"/>B
<input type="radio" id="CC" name="radio" value="C" onclick="fun()"/>C
</form>
<div id="A">
A1,A2,A3
</div>
<div id="B">
B1,B2,B3
</div>
<div id="C">
C1,C2,C3。
</div>
</body>




function func(){
$("#B").hide();
$("#C").hide();
}
function fun(){
var temp = $("[name=radio]:input");
if(temp[0].checked){
$("#A").show();
$("#B").hide();
$("#C").hide();
}else if(temp[1].checked){
$("#A").hide();
$("#B").show();
$("#C").hide();
}else if(temp[2].checked){
$("#A").hide();
$("#B").hide();
$("#C").show();
}

}

------解决方案--------------------
用ajax好
------解决方案--------------------
给简洁的
function changeValue(){
   $("select_A1").html("<option>A1</option><option>A2</option><option>A3</option>");
}

--------------
<select id="select_A1">
</select>
<select id="select_B1">
</select>
<select id="select_C1">
</select>
------解决方案--------------------
这个查查资料。 直接的方法。
------解决方案--------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <title> New Document </title>
  <meta name="Generator" content="EditPlus">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <script src="jquery.min.js" type="text/javascript"></script>
   <script src="demo.js" type="text/javascript"></script>
 </head>

 <body>
<input type="radio" id="a1">A</input>
<input&n