|
|
| Article |
Jacobs
Contributing Member

Articles: 2 Comments: 3
|
|
|
| Posted: Wed Jun 06, 2007 4:12 pm |
|
|
This article example shows how to implement select/deselect a check box group using one main check box.
Example given here has tested only on IE and Firefox so you may want to try and test it before using this in your web pages . Please post your comments on this article if you have any.
| Code: | <script type="text/javascript">
<!--
function CheckORUnCheck (chkBox) {
var arrVals = document.getElementsByTagName("input");
for (x=0; x<arrVals.length; x++) {
if (arrVals[x].type == 'checkbox') {
if (chkBox.checked==true){
// select mode
arrVals[x].checked = true;
}else{
//deselect mode
arrVals[x].checked = false;
}
}
}
}
-->
</script>
<strong>Play List:</strong>
<form id="checkboxtest" method="get" action="">
<input type="checkbox" name="chk_main" id="chk_main" value="" onClick="CheckORUnCheck(this);" />
Select or Deselect all songs<br />
<input type="checkbox" name="chk_1" id="chk_1" value="1" /> Song 1 <br />
<input type="checkbox" name="chk_2" id="chk_2" value="2" /> Song 2 <br />
<input type="checkbox" name="chk_3" id="chk_3" value="3" /> Song 3 <br />
<input type="checkbox" name="chk_4" id="chk_4" value="4" /> Song 4 <br />
<input type="checkbox" name="chk_5" id="chk_5" value="5" /> Song 5 <br />
</form>
|
Happy Programming! |
|
|
| Comments |
| No comments were made for this article |
| |
|
All times are GMT
You cannot post articles in this chapter You cannot edit your articles in this chapter You cannot delete your articles in this chapter You cannot rate articles in this chapter
You cannot post comments in this chapter You cannot edit your comments in this chapter You cannot delete your comments in this chapter You cannot rate comments in this chapter
|
|