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

关于javascript的问题
前面是个select   。后面是一个select和text控件,且是重叠在一起的。
现在我想,选择前面select的某个项,后面能进行切换。

------解决方案--------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 " />
<title> 无标题文档 </title>
</head>

<body>
<script language= "javascript ">
function selectchange(){
if(selecter.value==1){select1.style.display= ' ';text1.style.display= 'none ';}
if(selecter.value==2){select1.style.display= 'none ';text1.style.display= ' ';}
}
</script>
<select id= "selecter " onchange= "selectchange() ">
<option value= "0 "> ---请选择--- </option>
<option value= "1 "> 下拉列表 </option>
<option value= "2 "> 文本输入 </option>
</select>
<select id= "select1 ">
<option> 选项一 </option>
<option> 选项二 </option>
<option> 选项三 </option>
<option> 选项四 </option>
<option> 选项五 </option>
</select>
<input id= "text1 " type= "text " size= "12 " style= "display:none "/>
</body>
</html>

给点分吧,我没分了...