写一段javascript 语句实现
通过选择DropDownList的Value 来隐藏相应表..
我是这么写的.
<script type="text/javascript">
function type()
{
if(document.getElementById("select1").options[document.getElementById("select1").selectedIndex].value == "0")
{
document.getElementById("1").style.display ="none";
document.getElementById("2").style.display ="";
}
else if(document.getElementById("select1").options[document.getElementById("select1").selectedIndex].value == "1")
{
document.getElementById("1").style.display ="";
document.getElementById("2").style.display ="none";
}
}
</script>
<select name="select1" id="select1" onchange="type();">
<option value="1">a</option>
<option value="2">b</option>
</select>没有反应..
请各位帮帮忙 如何写才对..谢谢
通过选择DropDownList的Value 来隐藏相应表..
我是这么写的.
<script type="text/javascript">
function type()
{
if(document.getElementById("select1").options[document.getElementById("select1").selectedIndex].value == "0")
{
document.getElementById("1").style.display ="none";
document.getElementById("2").style.display ="";
}
else if(document.getElementById("select1").options[document.getElementById("select1").selectedIndex].value == "1")
{
document.getElementById("1").style.display ="";
document.getElementById("2").style.display ="none";
}
}
</script>
<select name="select1" id="select1" onchange="type();">
<option value="1">a</option>
<option value="2">b</option>
</select>没有反应..
请各位帮帮忙 如何写才对..谢谢
解决方案 »
- 求文本框不能输入单引号和空格正则表达式
- Inpath 数据对数据库操作问题(高分请教)
- 加密写表示层安全吗?
- HTML内嵌C#代码弹对话框问题
- public class MyClass : IDisposable {}--意思是定义一个非托管的什么...?请问这样定义有什么作用,什么情况下这样定义?
- 继续SessionID刷新问题....
- 关于Anthem控件数据没有更新.....
- 在C#中怎样将日期格式化?
- 请教关于 sqldatasetcommand 的小问题
- 新建项目的问题?
- Could not load file or assembly 'System.Web.Extensions, ,怎么办?谢谢
- 水晶报表不能正常显示
document.getElementById("1").style.display
document.getElementById("2").style.display这个错了
LZ你的名字起滴太C了撒
换个字母试试
<option value="1">a</option>
<option value="2">b</option>
</select>是这个 帖子里我没改
这里写成 onchange="return type();" 应该就可以了