隐藏的输入框如何在特定情况下显示出来? 我有一张选择项的表单,里面有:北京,上海,天津,重庆等选项,亦有三个隐藏了的输入框(输入),想问如何在选取了北京之后可以把这三个隐藏了的输入框显示出来?而选取上海,天津,重庆的时候则不用显示。谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <BODY> <select id="sele" OnChange="ff()"> <option value="1">北京 <option value="2">上海 </select> <input type="text" size="10" id="txt1"> <input type="text" size="10" id="txt2"> </BODY></HTML><SCRIPT LANGUAGE="JavaScript"><!-- function ff() { if (document.all.sele.selectedIndex == 0) { document.all.txt1.style.display = "" document.all.txt2.style.display = "" } else { document.all.txt1.style.display = "none" document.all.txt2.style.display = "none" } }//--></SCRIPT> <select onchange="show(this)"><option value="北京">....<div id="data" style="display:none"><input></div>function show(x){if(x.options[x.selectedIndex].value=="北京"){document.getElementById("data").style.display=""}else{document.getElementById("data").style.display="none"}} LS说得没错,1,2L都讲完了不过你相了解具体一点的话自己去搜“级联菜单”看吧 <select onchange="show(this.value)"><option value="2">隐藏</option><option value="1">显示</option></select><input id="a" style="display:none;"><script type="text/javascript">function show(t){if(t==1){ document.getElementById("a").style.display = "block"; document.getElementById("a").value = "";}else{ document.getElementById("a").style.display = "none";}}</script> 请高手看看图片滚动的问题。 ActiveXObject cannot be resolved to a type 求救! 如何获取某一个id下面的某一个tagname? 怎么用js判断ie的版本 对话框中的下拉列表 自定义confirm的问题 JS如何打开“另存为”对话框? 大家帮忙看一下,这段代码有问题吗? 复制到剪切板的问题! 有没有刷新的东西。 JSP做的flash中,怎样找到flash用的原图片。 如何实现google地图定位,位置显示在中间并使中间的图标闪烁?
<select id="sele" OnChange="ff()">
<option value="1">北京
<option value="2">上海
</select>
<input type="text" size="10" id="txt1">
<input type="text" size="10" id="txt2">
</BODY>
</HTML>
<SCRIPT LANGUAGE="JavaScript">
<!--
function ff()
{
if (document.all.sele.selectedIndex == 0)
{
document.all.txt1.style.display = ""
document.all.txt2.style.display = ""
}
else
{
document.all.txt1.style.display = "none"
document.all.txt2.style.display = "none"
}
}
//-->
</SCRIPT>
<option value="北京">....
<div id="data" style="display:none"><input></div>
function show(x)
{
if(x.options[x.selectedIndex].value=="北京")
{
document.getElementById("data").style.display=""
}
else
{document.getElementById("data").style.display="none"
}
}
不过你相了解具体一点的话自己去搜“级联菜单”看吧
<option value="2">隐藏</option>
<option value="1">显示</option>
</select>
<input id="a" style="display:none;">
<script type="text/javascript">
function show(t){
if(t==1)
{
document.getElementById("a").style.display = "block";
document.getElementById("a").value = "";
}
else
{
document.getElementById("a").style.display = "none";
}}
</script>