zoukankan
html css js c++ java
用js 判断datagrid 中的 checkbox 是否被选中
private
void
Page_Load(
object
sender, System.EventArgs e)
{
//
在此处放置用户代码以初始化页面
this
.sqlDataAdapter1.Fill (
this
.dataSet11 );
this
.DataGrid1.DataSource
=
this
.dataSet11.Tables[
0
];
this
.DataGrid1 .DataBind ();
this
.Button1.Attributes.Add (
"
onclick
"
,
"
return get_value('
"
+
this
.DataGrid1.ID .ToString ()
+
"
')
"
);
}
function
get_value(dataid)
{
var
s
=
document.getElementsByTagName(
"
input
"
)
var
flag
=
false
;
for
(i
=
0
;i
<
s.length;i
++
)
{
if
(s[i].type
==
"
checkbox
"
&&
s[i].checked
&&
s[i].id.substring (
0
,dataid.length)
==
dataid)
//
判断是否为checkbox 类型,判断是否被选中,判断是不是 datagrid 的 checkbox .
//
此处注意命名时不能以 datagrid 命名开头的 例如 datagrid id 为 abc, 就不能再命名以 abc 命名开头的了 比如命名为 abcd,abce,abcdefb,
{
flag
=
true
;
}
}
if
(flag)
return
window.confirm(
"
删除吗
"
);
else
{
window.alert (
"
你没有选择数据
"
)
return
false
;
}
}
查看全文
相关阅读:
腾信短信接口实例
ajax
jquery
生命鸡汤
sql中事物
ajax,一般处理程序,登陆
CSS选择器大全
【JavaScript】轮播图
【DOM练习】淘宝购物车
【DOM练习】百度历史搜索栏
原文地址:https://www.cnblogs.com/gwazy/p/170701.html
最新文章
水
核酸
化学公式
物质的量浓度
蛋白质
氯
在MVC中Dashboard基础入门操作
创建txt文件并写如数据
数据写入txt文件
提取json数据
热门文章
JsonHelper
读取JSON文件
EF连接字符串加密及封装
JS获取登录者IP和登录城市
MVC中使用viewmodel
在自己写的C#类中调用 ASP.NET的Request,server 等对象
MVC多张图片上传
List转换成为ArrayList
生成静态页面的几种方案
ASP.Net生成静态HTML页!
Copyright © 2011-2022 走看看