您的位置:首页 > Web前端 > JavaScript

js 判断项目中CheckBox 是否选中

2013-04-19 10:57 746 查看
<!--js部分-->

<script type="text/javascript">

function aa() {

var b = false;

var objs = document.getElementsByName("ids");

var a = 0;

var val = "";

for (var i = 0; i < objs.length; i++) {

if (objs[i].checked) {

if (a <= 0) {

b = true;

val = objs[i].value

a = a + 1;

document.getElementById("aaa").href = "Customers/CustomerAction.aspx?id=" + val;

}

if (a > 2) {

alert('只能选中一个厂商');

}

}

}

if (a == 0) {

alert('请选择一个厂商');

navTab.reload();

}

}

</script>

<!--Html 部分-->

<div class="pageContent">

<div class="panelBar">

</div>

<table class="table" width="100%" layoutH="138">

<thead>

<tr>

<th width="22"><input type="checkbox" group="ids" class="checkboxCtrl"></th>

<th width="50" class = "id" >供应商编号</th>

<th align="center" class="style1">供应商名称</th>

<th width="100" align="center">城市</th>

<th width="100" align="center">区县</th>

<th width="100" align="center">客户类型</th>

</tr>

</thead>

<tbody>

<asp:Repeater ID="RepeaterTr" runat="server" >

<ItemTemplate>

<tr target="sid_user">

<td><input name="ids" type="checkbox" value="<%#DataBinder.Eval(Container.DataItem, "id")%>" /></td>

<!--中文名称、英文名称、图片地址-->

<td> <%#DataBinder.Eval(Container.DataItem, "id")%></td>

<td> <%#DataBinder.Eval(Container.DataItem, "customername")%></td>

<td> <%#DataBinder.Eval(Container.DataItem, "provice")%></td>

<td> <%#DataBinder.Eval(Container.DataItem, "city")%></td>

</tr>

</ItemTemplate>

</asp:Repeater>

</tbody>

</table>

</div>

</div>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: