Home > Web Front-end > JS Tutorial > Javascript gets the number selected in CheckBoxList_javascript skills

Javascript gets the number selected in CheckBoxList_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 18:43:13
Original
1286 people have browsed it

jQuery's selectors are really powerful and flexible. JavaScript's original approach is also worth looking into.

Copy code The code is as follows:

<%@ Page Language="C#" AutoEventWireup= "true" CodeFile="CheckBoxList.aspx.cs" Inherits="CheckBoxList" %>








jQuery's selector is really powerful and flexible.

The original method of javascript is also worth studying.




1
2
< ;asp:ListItem>3










using System;
using System.Data;
using System .Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls ;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class CheckBoxList : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnOk_Click(object sender, EventArgs e)
{
int totalNum = 0;//Total number
string list = "000"; //Selected value
for (int i = 0; i < this.chkBox.Items.Count; i )
{
if (chkBox.Items[i].Selected )
{
totalNum = 1;
list = "," chkBox.Items[i].Value;
}
}
Response.Write(totalNum.ToString() " |" list);
}
}

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
What are JavaScript hook functions?
From 1970-01-01 08:00:00
0
0
0
What is JavaScript garbage collection?
From 1970-01-01 08:00:00
0
0
0
c++ calls javascript
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template