checkboxes set to true using JavaScript

checkboxes set to true using JavaScript

To set all checkboxes to true using JavaScript?

View Answers

November 10, 2010 at 12:36 PM

We can use following code to set all the checkboxes to true using javaScript.

Gyan
Singh
Ankit
Kumar
Kaushal


November 10, 2010 at 12:36 PM

We can use following code to set all the checkboxes to true using javaScript.

Gyan
Singh
Ankit
Kumar
Kaushal


November 10, 2010 at 12:37 PM

<head>
<script type="text/javascript">
function SelectAll() {
var checkboxes = document.getElementsByTagName("input");
for(i=0;i<checkboxes.length;i++) {
if(checkboxes.item(i).attributes["type"].value == "checkbox") {
checkboxes.item(i).checked = true;
}
}
}
function deSelectAll() {
var checkboxes = document.getElementsByTagName("input");
for(i=0;i<checkboxes.length;i++) {
if(checkboxes.item(i).attributes["type"].value == "checkbox") {
checkboxes.item(i).checked = false;
}
}
}
</script>
</head>
<body>
<input type="checkbox" name="list" value="1">Gyan<br>
<input type="checkbox" name="list" value="2">Singh<br>
<input type="checkbox" name="list" value="3">Ankit<br>
<input type="checkbox" name="list" value="4">Kumar<br>
<input type="checkbox" name="list" value="5">Kaushal<br>
<input type="submit" value="checkAll" onclick="SelectAll()" />
<input type="submit" value="uncheckAll" onclick="deSelectAll()" />

</body>









Related Tutorials/Questions & Answers:
checkboxes set to true using JavaScript
checkboxes set to true using JavaScript  To set all checkboxes to true using JavaScript
set the focus on an element using Javascript
set the focus on an element using Javascript  How to set the focus on an element using Javascript
Advertisements
JavaScript Array of checkboxes
JavaScript Array of checkboxes   ... that help you in understanding JavaScript Array of checkboxes. For this we are using JavaScript as Script language. In this example we make a HTML form
property in javascript get set
property in javascript get set  How to create the get and set property in JavaScript?   Creating Get and Set properties in JavaScript example.. myVar Sample = { nval : "", get get() { return this.nval; }, set
javascript set scroll height
javascript set scroll height  How to set scroll height in JavaScript?   CSS Scroll Method div { width:150px; height:150px; overflow:scroll; } JavaScript ScrollTo method <script type="text/javascript">
how to display selected checkboxes dynamically using jsp
how to display selected checkboxes dynamically using jsp  Hi friends i have a requirement that : in my JSP page i have radio buttons followed by the DB fields..when i click SUBMIT button,if the field(or record
Maintaining States of Selected CheckBoxes in Different Pages using dispaly table in struts2
Maintaining States of Selected CheckBoxes in Different Pages using dispaly... me how to maintain States of Selected CheckBoxes in Different Pages using... i am showing the list using a displaytag.Each row in the list has a checkbox
send mail using JavaScript
send mail using JavaScript  How can we send mail using JavaScript?   Hi friends, You can not send email directly using JavaScript. But you can use JavaScript to execute a client side email program send the email using
delete an entry using JavaScript
delete an entry using JavaScript  How to delete an entry using JavaScript
Date object using JavaScript
Date object using JavaScript  What's the Date object using JavaScript
using for loop in javascript
using for loop in javascript  How to use for loop in JavaScript
maximize an image using javaScript
maximize an image using javaScript  Write the code to maximize an image using javaScript
xls to js using javascript
xls to js using javascript  ![how can we convert a xls file in js file using javascript][1
timer using javascript
timer using javascript  How to display timer on HTML page using JavaScript
How to use Sigma grid built-in capabilities to calculate aggregates where Sortable property set to TRUE
Sortable property set to TRUE  How to use Sigma grid built-in capabilities to calculate aggregates where Sortable property set to TRUE, So that We can also...: but here Sortable property has been set to false. I need to implement
How to shift and unshift using JavaScript?
How to shift and unshift using JavaScript?  How to shift and unshift using JavaScript
Updating multiple value depending on checkboxes
Updating multiple value depending on checkboxes  Hi .. I want to Update the multiple values of database using checkboxes and want to set the session for selected checkboxes..? please answer if any one knows as soon as possible
convert numbers to strings using JavaScript
convert numbers to strings using JavaScript  How to convert numbers to strings using JavaScript
read and write a file using javascript
read and write a file using javascript  How to read and write a file using javascript
Math Constants and Functions using JavaScript
Math Constants and Functions using JavaScript  What's Math Constants and Functions using JavaScript
associate functions with objects using JavaScript
associate functions with objects using JavaScript  How to associate functions with objects using JavaScript
validate radio button using javascript
validate radio button using javascript  validate radio button using javascript
javascript date validation using regex
javascript date validation using regex  Hi, I want to validate the date using javascript. Please help.   <html> <head> <title>Validating Date format</title> <script type="text/javascript">
how to set values from parent page to iframe in javascript
how to set values from parent page to iframe in javascript  how to set values from parent page to iframe in javascript pls reply me as possible as I am in great trouble
enabling and disabling a hyperlinks using javascript only
enabling and disabling a hyperlinks using javascript only  Hi! Anyone... set containing 2 frames a source frame containing 1.jsp and a destination frame...').disabled=true; document.getElementById('listOfOwners').removeAttribute('href
Changing background color using JavaScript
Changing background color using JavaScript  Hi Sir Is there any way to change the background color using JavaScript ? Please mention code with your answer.   Hello Friend Pass the element & color in the given
enabling and disabling a hyperlinks using javascript only
enabling and disabling a hyperlinks using javascript only  Hi! can anyone help in enabling and disabling hyperlinks?. Question1: There is a frame set...="javaScript" type="text/javascript" src="calendar.js"> function disableLink
remove duplicates from list in java using set
this? Tell me program for the removal of duplicates from list in java using set... duplicates from list in java using set: import java.util.Arrays; import java.util.List...remove duplicates from list in java using set  Hi, I have a list
Solve using only Javascript loops...
Solve using only Javascript loops...  Write a JavaScript code, 1) to find a number of unique letters in string. (Eg. if keyword is unique, Unique count will be '4') 2) so that numbers appear in following format, 1 1 2
Calendar In JSP Using JavaScript
Calendar In JSP Using JavaScript   ... in JSP using JavaScript. We created the following files for the application... false; } return true; } </script> </head> <body>
How to insert multiple checkboxes into Msaccess database J2EE using prepared statement - Java Beginners
How to insert multiple checkboxes into Msaccess database J2EE using prepared statement  Dear Experts, Tried as I might looking for solutions to resolve my Servlet problem, I still can't resolve it. Hope that you can share
how to give validation using javascript in swing
how to give validation using javascript in swing   how to give validation using javascript in swing....... can somebody give code for username and password validation using javscript and swing
How to write a search functionality using javascript/jquery
How to write a search functionality using javascript/jquery   How to write a search functionality using javascript/jquery for ex: im searching "s" names it wil display "s" names
use strings as array indexes using JavaScript
use strings as array indexes using JavaScript  How to use strings as array indexes using JavaScript
create a string from an array using JavaScript
create a string from an array using JavaScript  How to use "join()" to create a string from an array using JavaScript
force a page to go to another page using JavaScript
force a page to go to another page using JavaScript  How to force a page to go to another page using JavaScript
flowcharts using javascript/HTML - Development process
flowcharts using javascript/HTML  Hi I want to create flowchart diagram using html/javascript.. is that possible.. please guide me Thanks!  Check this linkhttp://www.roseindia.net/jdbc/jdbc-driver-and-its-types.shtml
How to set a variable value using velocity
How to set a variable value using velocity       This Example shows you how to set variable value using velocity. The method used in this example are described below:- 1
how to set image in button using swing? - Swing AWT
how to set image in button using swing?  how to set the image in button using swing?  Hi friend, import java.awt.*; import..."); setSize(300,100); setVisible(true); addWindowListener(new
how to print HTML using javascript or Jquery
how to print HTML using javascript or Jquery  is there any way to print a document(created using Html and javascript) without using window.print, which works for all the browser specially chrome and firefox, I have used
Hide show HTML forms using javascript
Hide show HTML forms using javascript  How to hide a HTML form in my application using JavaScript?   HTML Code to create checkbox <...;div id="yourDiv"> ...other forms... </div> JavaScript function to hide
Set Timestamp by using the Prepared Statement
Set Timestamp by using the Prepared Statement... will teach how to set the Timestamp in database table by using...\PreparedStatement>java SetTimetamp Set Timestamp example by using the Prepared
Html form using JavaScript to display the table content
Html form using JavaScript to display the table content  HI There, Greetings, I am new to this java and I need your assistance. I have created... want to write a Html JavaScript coding to display the content from database
Set Textbox in PowerPoint Slide Using Java
Set Textbox in PowerPoint Slide Using Java       In this example we are going create textbox to set text in PowerPoint using java. In this example we are creating an object of 
javascript for textbox or prompt using servlet - JSP-Servlet
javascript for textbox or prompt using servlet  Dear sir, I am using a prompt(),when a delete is confirmed,its working fine ,but when...('Are you confirm')"); out.println("if (r==true){var reason=prompt('Reason
how to set values in object using java and what are the ways?
how to set values in object using java and what are the ways?  How to set values in object using java ?what are the ways
how to show set of images continously using JScrollpane in java
how to show set of images continously using JScrollpane in java  how to show set of images continously using JScrollpane in java
how to show set of images continously using JScrollpane in java
how to show set of images continously using JScrollpane in java  how to show set of images continously using JScrollpane in java
javascript for textbox or prompt using servlet - JSP-Servlet
javascript for textbox or prompt using servlet  Dear sir I am writing script in servlet,so prompt() is not working here so please help me...')"); out.println("if (r==true){var reason=prompt('Reason for deleting:')"); out.println
How to check text in textbox using JavaScript
How to check text in textbox using JavaScript  How to check text in textbox using JavaScript I have a form in HTML that contains text feilds... me.   JavaScript validation example to check text in textfeild <

Ads