为了账号安全,请及时绑定邮箱和手机立即绑定

第一个onchange 可以触发好使 第二个就不好使了 麻烦大神帮我看看哪块写的不对 急急急

第一个onchange 可以触发好使 第二个就不好使了 麻烦大神帮我看看哪块写的不对 急急急

<SCRIPT type="text/javascript"> function showShortName( )  {  var ctryName=document.myform.BuildingName.value;    var ctryType = new Array( );  ctryType['青莲公寓E楼']=['E楼'];  ctryType['青莲公寓C楼']=['C楼'];  ctryType['青莲公寓D楼'] = ['D楼'];  document.myform.BuildingShortName.options.length=0;  for (var j=0;j<ctryType[ctryName].length;j++)  {  document.myform.BuildingShortName.options.add(new Option(ctryType[ctryName][j], ctryType[ctryName][j])); }   document.myform.BuildingShortName.selectedIndex=0;  } </SCRIPT><script> function showNum( ){var NumName= document.myform.BuildingShortName.value; var ctryType = new Array( );ctryType['E楼']=['E1','E2','E3','E4'];ctryType['C楼']=['C1','C2','C3'];ctryType['D楼'] = ['D1','D2','D3'];document.myform.BuildingNum.options.length=0;for (var j=0;j<ctryType[NumName].length;j++) {document.myform.BuildingNum.options.add(new Option(ctryType[NumName][j], ctryType[NumName][j]));} document.myform.BuildingNum.selectedIndex=0;}</script><FORM action="" method="get" name="myform"  ><td>楼信息管理</td> </br></br>楼名:<select id="BuildingName" name="BuildingName"  onChange="showShortName()" > <option value="">全部</option> <option value="青莲公寓E楼">青莲公寓E楼</option> <option value="青莲公寓C楼">青莲公寓C楼</option><option value="青莲公寓D楼">青莲公寓D楼</option></select> </br> </br></br>楼简称:<select id="BuildingShortName" name="BuildingShortName"  onChange="showNum()"   > <option value="">    </option> </select></br> </br></br>楼号:<select id="BuildingNum" name="BuildingNum"> <option value="">   </option> </select> </br> </br></br></FORM>
查看完整描述

1 回答

?
谁的浮生乱了流年

TA贡献1条经验 获得超0个赞

或者可以让一个select有两个onchange触发么???  像下面代码一样,,不过也不好使 ,望哪位大神帮帮我,特别急 !!

<SCRIPT type="text/javascript">
 function showShortName( )
  {
  var ctryName=document.myform.BuildingName.value;
   var ctryType = new Array( );
  ctryType['青莲公寓E楼']=['E楼'];
  ctryType['青莲公寓C楼']=['C楼'];
  ctryType['青莲公寓D楼'] = ['D楼'];
  document.myform.BuildingShortName.options.length=0;
  for (var j=0;j<ctryType[ctryName].length;j++)
 {
  document.myform.BuildingShortName.options.add(new Option(ctryType[ctryName][j], ctryType[ctryName][j]));
 }
   document.myform.BuildingShortName.selectedIndex=0;
  }
 

</SCRIPT>

<script>
function showNum( )
{
var NumName= document.myform.BuildingName.value; 

var ctryType = new Array( );
ctryType['青莲公寓E楼']=['E1','E2','E3','E4'];
ctryType['青莲公寓C楼']=['C1','C2','C3'];
ctryType['青莲公寓D楼'] = ['D1','D2','D3'];
document.myform.BuildingNum.options.length=0;
for (var j=0;j<ctryType[NumName].length;j++)
{
document.myform.BuildingNum.options.add(new Option(ctryType[NumName][j], ctryType[NumName][j]));
}
 document.myform.BuildingNum.selectedIndex=0;
}
</script>

<FORM action="" method="get" name="myform"  >
<td>楼信息管理</td>
</br></br>
楼名:
<select id="BuildingName" name="BuildingName"  onChange="showShortName()" onChange1="showNum()" >
<option value="">全部</option>
<option value="青莲公寓E楼">青莲公寓E楼</option>
<option value="青莲公寓C楼">青莲公寓C楼</option>
<option value="青莲公寓D楼">青莲公寓D楼</option>
</select> </br> </br></br>

楼简称:
<select id="BuildingShortName" name="BuildingShortName"     >
<option value="">    </option>
</select>
</br> </br></br>

楼号:<select id="BuildingNum" name="BuildingNum">
<option value="">   </option>
</select>
</br> </br></br>

</FORM>


查看完整回答
反对 回复 2017-06-05
  • 1 回答
  • 0 关注
  • 1613 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信