问题:
当我选择第一个下拉列表框周杰伦,相应在歌曲下拉框只显示他的所有的歌,其他人的歌不显示,我不知道我那里写错了,请各位帮我看看,或者给新提示。例如周杰伦(双节棍、青花瓷、黑色幽默、稻香)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>无标题文档</title> <script language="javascript" type="text/javascript">
function option_select()
{
var selctd=document.getElementById("sel");
var childsel=document.getElementById("childsel");
switch(selctd.value)
{
case '1':switch(childsel.value)
{
case '1': childsel.value:break;
case '2': childsel.value:break;
case '3': childsel.value:break;
case '4': childsel.value:break;
};break;
case '2':switch(childsel.value)
{
case '11': childsel.value:break;
case '5': childsel.value:break;
case '6': childsel.value:break;
};break;
case '3':switch(childsel.value)
{
case '7': childsel.value:break;
case '8': childsel.value:break;
};break;
}
}
</script>
</head> <body>
<form name="selectform" method="post" >
选择你喜爱的歌星:<select name="sel" onChange="option_select()">
<option selected="selected" >--歌星--</option>
<option value="1" >周杰伦</option>
<option value="2" >吴克群</option>
<option value="3" >樊凡</option>
</select>
在选择相应的歌曲:
<select name="childsel" onChange="">
<option selected="selected" >--歌曲--</option>
<option value="1">双节棍</option>
<option value="2">青花瓷</option>
<option value="3">黑色幽默</option>
<option value="4">稻香</option>
<option value="11">我不能</option>
<option value="5">泛泛之辈</option>
<option value="6">大舌头</option>
<option value="7">燃烧的翅膀</option>
<option value="8">我要大声的告诉你</option>
</select> </form>
</body>
</html>
当我选择第一个下拉列表框周杰伦,相应在歌曲下拉框只显示他的所有的歌,其他人的歌不显示,我不知道我那里写错了,请各位帮我看看,或者给新提示。例如周杰伦(双节棍、青花瓷、黑色幽默、稻香)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>无标题文档</title> <script language="javascript" type="text/javascript">
function option_select()
{
var selctd=document.getElementById("sel");
var childsel=document.getElementById("childsel");
switch(selctd.value)
{
case '1':switch(childsel.value)
{
case '1': childsel.value:break;
case '2': childsel.value:break;
case '3': childsel.value:break;
case '4': childsel.value:break;
};break;
case '2':switch(childsel.value)
{
case '11': childsel.value:break;
case '5': childsel.value:break;
case '6': childsel.value:break;
};break;
case '3':switch(childsel.value)
{
case '7': childsel.value:break;
case '8': childsel.value:break;
};break;
}
}
</script>
</head> <body>
<form name="selectform" method="post" >
选择你喜爱的歌星:<select name="sel" onChange="option_select()">
<option selected="selected" >--歌星--</option>
<option value="1" >周杰伦</option>
<option value="2" >吴克群</option>
<option value="3" >樊凡</option>
</select>
在选择相应的歌曲:
<select name="childsel" onChange="">
<option selected="selected" >--歌曲--</option>
<option value="1">双节棍</option>
<option value="2">青花瓷</option>
<option value="3">黑色幽默</option>
<option value="4">稻香</option>
<option value="11">我不能</option>
<option value="5">泛泛之辈</option>
<option value="6">大舌头</option>
<option value="7">燃烧的翅膀</option>
<option value="8">我要大声的告诉你</option>
</select> </form>
</body>
</html>
['双节棍','青花瓷','黑色幽默','稻香'],['我不能','泛泛之辈','大舌头'],['燃烧的翅膀','我要大声的告诉你']
];
function option_select()
{
var selctd=document.getElementById("sel");
var childsel=document.getElementById("childsel");if(selctd.selectedIndex>0)
{
childsel.options.length = 1;
for(var i=0;i<mp3[selctd.selectedIndex-1].length;i++){
childsel.options.add(new Option(mp3[selctd.selectedIndex-1][i],mp3[selctd.selectedIndex-1][i]));
}
}
}