紧急救助~

thisisxutao 2009-04-17 04:57:10
需要实现控制功能,在网上找了一段代码,但实现不了,代码如下:
<html>


<BODY >
<form name= "branchForm " method= "post ">

<select name= "branchLevel " property= "ilevel " OnChange= "selectdu()" size= "1 " style= "width: 210px; height: 20 " >
<option value= " "/>
<option value=17> 国家 </option>
<option value=18> 省(州) </option>
<option value=19> 地、市、厅 </option>
<option value=20> 院(处) </option>
</select>

<select name= "nation " style= "width:210px; height: 20 "> </select>
<select name= "province " style= "width:210px; height: 20 "> </select>
<select name= "organizaiton " style= "width:210px; height: 20 "> </select>
</form>
<script language= "JavaScript ">
function selectdu()
{
var obj= document.branchForm;
var strSel = obj.branchLevel.options[document.branchForm.branchLevel.selectedIndex].text;
alert(strSel);
if(strSel=="国家 ")
{
obj.nation.disabled = true;
obj.province.disabled = true;
obj.organizaiton.disabled = true;
}
else if(strSel == "省(州) ")
{
obj.nation.disabled = false;
obj.province.disabled = true;
obj.organizaiton.disabled =true;
}
else if(strSel=="地、市、厅 ")
{
obj.nation.disabled = false;
obj.province.disabled = false;
obj.organizaiton.disabled = true;
}
else
{
obj.nation.disabled =false;
obj.province.disabled =false;
obj.organizaiton.disabled=false;
}
}

</script>
</BODY>
</html>

谢谢!
...全文
63 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
mumu_java 2009-04-17
  • 打赏
  • 举报
回复
呵呵。
thisisxutao 2009-04-17
  • 打赏
  • 举报
回复
可以了,谢谢Free_Wind22
thisisxutao 2009-04-17
  • 打赏
  • 举报
回复
好象在左下角地址栏有个黄色的感叹号,提示什么"缺少对象"
2009-04-17
  • 打赏
  • 举报
回复

<html>
<BODY>
<form name= "branchForm" method= "post">
<select name= "branchLevel" property= "ilevel" onChange= "selectdu()" size= "1" style= "width: 210px; height: 20 " >
<option value= " "/>
<option value=17> 国家 </option>
<option value=18> 省(州) </option>
<option value=19> 地、市、厅 </option>
<option value=20> 院(处) </option>
</select>

<select name= "nation" style= "width:210px; height:20 "> </select>
<select name= "province" style= "width:210px; height:20 "> </select>
<select name= "organizaiton" style= "width:210px; height:20 "></select>
</form>
<script language= "JavaScript">
function selectdu()
{
var obj= document.branchForm;
var strSel = obj.branchLevel.options[document.branchForm.branchLevel.selectedIndex].text;
alert(strSel);
if(strSel=="国家")
{
obj.nation.disabled = false;
obj.province.disabled = true;
obj.organizaiton.disabled = true;
}
else if(strSel == "省(州)")
{
obj.nation.disabled = true;
obj.province.disabled = false;
obj.organizaiton.disabled =true;
}
else if(strSel=="地、市、厅")
{
obj.nation.disabled = true;
obj.province.disabled = true;
obj.organizaiton.disabled = false;
}
else
{
obj.nation.disabled =false;
obj.province.disabled =false;
obj.organizaiton.disabled=false;
}
}

</script>
</BODY>
</html>

thisisxutao 2009-04-17
  • 打赏
  • 举报
回复
只要是根据下拉框的值控制其他几个下拉框
thisisxutao 2009-04-17
  • 打赏
  • 举报
回复
测试后立马给分,多谢了
bing475879749 2009-04-17
  • 打赏
  • 举报
回复
????????
四级联动菜单?????

你可以搜索下噻

87,923

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧