javascript下隐藏DropDownList1 javascript下隐藏DropDownList1我现在做了一个弹出的DIV,现在想把DropDownList1隐藏了,要不他老是在最上面 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 document.getElementById("DropDownList1").style.display="none"; 百度空间的留言就是隐藏的,IE和FF都能实现,可是我不知道是哪个代码 scjtswj 能做到一下隐藏多个吗,在不知道控件名的情况下 晃晃你们老总,弹出DIV的时候在enabled一下 点击html按钮时隐藏DropDownList。<head runat="server"><style type="text/css"> .invisible {display: none;}</style><script type="text/javascript" language="javascript"> function Button1_onclick() { document.getElementById('<%= DropDownList1.ClientID %>').className="invisible";}</script></head><body > <form id="form1" runat="server"> <div> <asp:DropDownList ID="DropDownList1" runat="server"> <asp:ListItem>1</asp:ListItem> <asp:ListItem>2</asp:ListItem> <asp:ListItem>3</asp:ListItem> <asp:ListItem>4</asp:ListItem> </asp:DropDownList> <input id="Button1" type="button" value="button" onclick="return Button1_onclick()" /></div> </form></body> 在DIV上加上一个IFRIAME 网上代码一大堆 一搜就能搜到~ function AllDropDownLists(){ for (var i=0;i<Form1.elements.length;i++) { var e = Form1.elements[i]; if (e.type == 'select') { e.style.display = "none"; } }}<asp:DropDownList ID="DropDownList1" Runat="server" type="select"></asp:DropDownList>把Form下type="select"的下拉框都隱藏,當然這個type的值,你可以自己隨意寫,還有Form的ID也是一樣的。在vs2003下測試通過。 以前写过一个用iframe遮罩的,就可以遮住dropdownlist,前几天找没找到这个例子。汉 我在网上搜到一个很简单的代码,使用起来也很简单,只需要在你被挡住的div标签下加个什么都没有的iframe就可以了 可以隐藏N个不知道名的dropdownlist ,通过javascript.javascript<script type="text/javascript">function hooyes_hide(){var obj=getTag('select');for(var i=0;i<obj.length;i++){ obj[i].style.display='none'; }}function getTag(x){return document.getElementsByTagName(x);}</script>html<body>这里可以放N个dropdownlist,点击这个按钮测试一下,就看到效果了.<input name="hideDropdownlist" value="把所有Dropdownlist隐藏起来:)" onclick="hooyes_hide()" type="button" /></body> 参考这里的覆盖select EXCEL导出问题求高人帮忙,在线等 table背景属性,还有没睡的大哥么? 一个关于样式链接的怪问题 如何控制Label显示字数? 关于 权限的问题 在外面登录不了后台,但在本地又可以登录进去,怪 关于js子窗口调用父窗口类的问题 win2003下发布错误 在用VSS时遇到的问题 谁有推技术的聊天室代码? 如何动态修改样式?????? 关于select控件在gridview里面遮住标题的问题!
能做到一下隐藏多个吗,在不知道控件名的情况下
<head runat="server">
<style type="text/css">
.invisible {display: none;}
</style><script type="text/javascript" language="javascript">
function Button1_onclick() {
document.getElementById('<%= DropDownList1.ClientID %>').className="invisible";
}
</script></head><body >
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
</asp:DropDownList>
<input id="Button1" type="button" value="button" onclick="return Button1_onclick()" /></div>
</form>
</body>
function AllDropDownLists()
{
for (var i=0;i<Form1.elements.length;i++)
{
var e = Form1.elements[i];
if (e.type == 'select')
{
e.style.display = "none";
}
}
}
<asp:DropDownList ID="DropDownList1" Runat="server" type="select"></asp:DropDownList>把Form下type="select"的下拉框都隱藏,當然這個type的值,你可以自己隨意寫,
還有Form的ID也是一樣的。
在vs2003下測試通過。
通过javascript.javascript<script type="text/javascript">
function hooyes_hide()
{
var obj=getTag('select');
for(var i=0;i<obj.length;i++){ obj[i].style.display='none'; }
}
function getTag(x){return document.getElementsByTagName(x);}</script>html
<body>
这里可以放N个dropdownlist,点击这个按钮测试一下,就看到效果了.<input name="hideDropdownlist" value="把所有Dropdownlist隐藏起来:)" onclick="hooyes_hide()" type="button" />
</body>