在ASP.NET中,在树形菜单(TreeView)前面加上TextBox,让一个TextBox选中,其余TextBox全选中,怎么写呀,求代码解析!!
解决方案 »
- textBlock内容更新后,如何让滚动条跟随textBlock的内容自动滚动?
- c#中button的click事件
- 怎样在 Membership 数据库另生成一张表UserID表,与Membership 中的GUID对应上?
- 程序如何识别图像
- 无法将类型“System.IO.StreamWriter”隐式转换为“StreamWriter”
- 修改.net可执行程序的资源,up有分
- 如何重写用户控件的HTML代码?
- 如何把一个屏幕的坐标,转换成一个控件的相对坐标,如果用API实现也行?
- 怎样做一个“杀不死”的程序?
- c# 操作word横纵混合排列
- 如何能自动抓异常?
- ERP系统的易用性和可用性问题
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>无标题</title>
<script type="text/javascript">
// 全选
function checkall() {
var all = document.getElementsByTagName("input");
for (var i = 0; i < all.length; i++) {
if (all[i].type == "checkbox") {
all[i].checked = true;
}
}
}
//反选
function checknull() {
var all = document.getElementsByTagName("input");
for (var i = 0; i < all.length; i++) {
if (all[i].type == "checkbox") {
all[i].checked = false;
}
}
}
</script></head>
<body onload="listpage()">
<form id="form1" runat="server">
<div>
<div id="str">
</div>
<input type="checkbox" id="Checkbox1" value="1" />测试1<br/>
<input type="checkbox" id="Checkbox2" value="2" />测试2<br/>
<input type="checkbox" id="Checkbox3" value="3" />测试3<br/>
<input type="checkbox" id="Checkbox4" value="4" />测试4<br/>
<input type="checkbox" id="Checkbox5" value="5" />测试5<br/>
<input type="checkbox" id="Checkbox6" value="6" />测试6<br/>
<input type="checkbox" id="Checkbox7" value="7" />测试7<br/>
<input type="checkbox" id="Checkbox8" value="8" />测试8<br/>
<input type="checkbox" id="Checkbox9" value="9" />测试9<br/>
<input id="Button1" type="button" value="全选" onclick="checkall()" />
<input id="Button2" type="button" value="反选" onclick="checknull()" />
</div>
</form>
</body>
</html>可以看看,正反选的