|
BeTheBall -> RE: Getting Select All value to work (6/3/2004 10:42:58)
|
Here is some code that will allow you to have a "Check All" option with your new way of doing things. First, put this code in the <head> section of the page that has your checkboxes: <script>
var allBoxes = ["CampSite1", "CampSite2", "CampSite3", "CampSite1", "CampSite4", "CampSite5", "CampSite6", "CampSite7", "CampSite8", "CampSite9", "CampSite10", "CampSite11"];
function checkAll(theBox){
theForm = theBox.form;
for(i=0;i<allBoxes.length;i++){
theForm[allBoxes].checked = theBox.checked;
}
theSpan = document.getElementById('unCheck');
if(theBox.checked==true){
theSpan.innerHTML = "Uncheck";
} else {
theSpan.innerHTML = "Check";
}
}
You just need to add the other 15 or so checkbox names. Then, above the code for the first checkbox, add this line: <input type=checkbox name="CheckAll" onClick="checkAll(this)"><span id="unCheck">Check</span> All<br> When a user checks the CheckAll box, all the other checkboxes will become checked. However, the disabled ones, will not submit to the database even though they will display as checked. They will also remain greyed-out. Give it a try and see if it's still what you want.
|
|
|
|