We did a survey and voted for a good employee, so after the vote, we wanted to look at the results, and in SharePoint 2010, we voted for the default graphical summary, as shown below:
Such statistics, obviously not the statistical results we want, should be summed up every outstanding staff votes, rather than the combination of multiple selection and total. So we rewrite the graph summary, and the effect is as follows
If the
Today, I met a new person who asked me how jquery could get the Value selected in the checkbox. So I wrote one with my hand! Practical and simple. For this reason, I am very shy of posting!
Code
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->
Because of the jquery version problem, take the checkbox of the selected state value, was killed miserably ...
The following is an online summary (http://www.wufangbo.com/jquery-pan-duan-checked/):
The three ways jquery judges checked:
. attr (' checked ')://See version 1.6+ return: "Checked" or "undefined"; 1.5-return: TRUE or False. Prop (' checked ')://16+:true/false. Is (': Checked ')://All Versions: true/false//don't forget the colon!
Sever
4, with multiple checkboxes, select the first selected checkbox: $ ("#btn"). Click (function () { //Select the checkbox preceded by a colon, select the attribute preceded by a colon var checks = $ ("#table2: checkbox:checked"); if (Checks.length > 0) { //eq is the first number, starting from 0 var sid = Checks.eq (0). Parent (). Parent
I don't know if you have any experience like this. When you click or cancel the checkbox column of the datagridview dview, it is difficult to determine whether the status is selected or not, which makes it difficult to perform other operations, the solution is listed below:
The CurrentCellDirtyStateChanged and CellValueChanged events of the dview are mainly used.
The CurrentCellDirtyStateChanged event submits changes to the
Select All or invert settings for the checkbox in the list, and select all for the checkboxSelect all settings for checkbox selection in the list
1
The above code mainly handles
1. If a row is selected in the list, the checkbox of the row is selected. If you click it again, the checkbox is deselected.
2. The list cont
= $ ("); $ (". Selector2"). Append (option);});jquery sets the text and value selected for select:Syntax Explanation:$ ("#select_id"). Get (0). selectedindex=1; // Set the Select index value to 1 to select $ ("#select_id"). Val (4); // Sets the value of select to 4 for the item selected true); // set the text value of select to the item selected for jquery1. Gets the value of a set of radio selected itemsVar2. Get the text of select selected itemVar3. The second element of the Select
In asp.net, you can use the template column, in the GridView implementation of the CheckBox column, the relevant code is not complex, you can refer to here, I extracted some of the code as follows:
The code is as follows
Copy Code
Autogeneratecolumns= "False"datakeynames= "id" datasourceid= "Accessdatasource1″ allowsorting= "True" ondatabinding= "gridview1_databinding"onrowdatabound= "GridView1_RowDataBound" >Checked=
Lt; INPUTclass = quot; checkbox quot; type = quot; checkbox quot; name = quot; ids [] quot; value = quot; $ audio [id] quot; gt; name = quot; ids [] quot
What is the use of this name = "ids?
------ Solution --------------------
Ids [] = 1;
Ids [] = 2;
Uploading to php is an array
$ _ POST [ids] = array (1, 2 );
------ Solution --------------------
Name = "ids []", here is the check bo
In PHP, how does one obtain the content submitted by the CHECKBOX and select all the submission pages of the checkbox? Does js control select all and cancel all? Lt; scripttypetextjavascript gt ;? Functioncheck_all (obj, cName )? {????? Varcheckboxsdocument. getElementsByName (in cNam PHP, retrieve the content submitted by the CHECKBOX and select all the checkb
The jquery method is as follows:
CopyCode The Code is as follows: function checkall (VAL ){
$ ("Input [name = 'chkjob']"). Each (function (){
This. Checked = val;
});
$ ("# Chkall"). ATTR ("checked", Val); // you can specify the status of the Select All button.
}
Val this parameter specifies the selection status of the Select All button. name = 'chkjob' indicates the checkbox name in the list. chkall indicates the name of the Select All button.
Let's say there's a checkbox named CheckBox1 on the Web page with a form,form named Form1.
The code is as follows
Copy Code
var f = document.form1;var sum=0;if (f.checkbox1.length) {for (var i=0;i if (f.checkbox1[i].checked==true)sum=sum+1;}}else{if (f.checkbox1.checked) {Sum=1;}}Console.log (sum);
Note that the outermost if judgment, f.checkbox1.length returns undefined when there is only one
Html
Usually we use the following HTML structure, we define ID#CHECKBOX_A1 for the check box, and then use the label's for property to associate with it, so that when the user clicks on the label, it is actually the equivalent of clicking on the #checkbox_a1.Check
Css
By label and checkbox, we can hide the checkbox and make the label a nice, cool check box style. We can use: Before and: After pseudo element
Let's say there's a checkbox named CheckBox1 on the Web page with a form,form named Form1.
The code is as follows
var f = document.form1;var sum=0;if (f.checkbox1.length) {for (var i=0;i if (f.checkbox1[i].checked==true)sum=sum+1;}}else{if (f.checkbox1.checked) {Sum=1;}}Console.log (sum);
Note that the outermost if judgment, f.checkbox1.length returns undefined when there is only one
The jquery method is as follows:
Copy Code code as follows:
Function Checkall (val) {
$ ("Input[name= ' Chkjob ']"). each (function () {
this.checked = val;
});
$ ("#chkAll"). attr ("Checked", Val);//Set all Select button Status
}
Val, this parameter passes the selection state of the full selection button.
Name= ' Chkjob ' This is the name of the checkbox in the list
Chkall is the full Select button name
Love the sim
Well, now everything is ready, and we have nothing to worry about. Let's see how simple a public opinion survey is:
File: vote. aspx
File: vote. csNamespace Football{Using System;Using System. Collections;Using System. ComponentModel;Using System. Data;Using System. Drawing;Using System. Web;Using System. Web. SessionState;Using System. Web. UI;Using System. Web. UI. WebControls;Using System. Web. UI. HtmlControls;
/// /// Summary description for
it in a virtual environment, and debugging and grooming Python code.Frequently used features and toolsInfrequently used features and toolsEditor-level differencesWe found a huge difference between using pycharm and other editors.For example, the ratio of pycharm users to auto-completion is up to 86%, compared with 60% for other editors. Pycharm users more often use debuggers, code refactoring, and use in virtual environments.In the use of Run/debug or remote edit code only, using a different ed
The best PHP Framework survey in 2015 counts the most popular framework in 2015. Laravel won the winner!
As expected, Laravel was once again much higher.
Some may worry that some split versions of the framework may affect Laravel's findings and give it an unfair advantage, but we can see that even if all other frameworks merge versions, laravel can also win.
The data is presented in a table, but I don't have time to make beautiful charts. I wil
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.