>Hey guys,
> 
>I'm having a hard time making this work... it's probably my brain this
>morning.
> 
>I have a form with a series of checkboxes for a search.  One is 'all
>documents' and the rest identify certain containers.
> 
>I need some JavaScript that will deselect 'All Documents' if somebody
>selects one of the other checkboxes.  Can somebody give me a hand?
> 
>These are my checkboxes:
> 
><input type="checkbox" name="all_documents" value="1" checked>All Documents
><input type="checkbox" name="annual_report" value="1">Annual Report
><input type="checkbox" name="book" value="1">Books and Studies
><input type="checkbox" name="briefing_paper" value="1">Briefing Papers
><input type="checkbox" name="issue_brief" value="1">Issue Briefs
><input type="checkbox" name="working_paper" value="1">Working Papers 
> 
>Thank you so much.
> 
>--
Here's what I used on a recent project, feel free to modify it:
<form>
<input type="checkbox" name="selectAll" onClick="toggleSelectList()">

<input name="view" type="checkbox" value="animalVirology" title="Select 
Virology">
<input name="view" type="checkbox" value="bacteria" title="Select Bacteria">
<input name="view" type="checkbox" value="monoclonal" title="Select Monoclonal>
</form>

<InvalidTag language="javascript" type="text/javascript">
    var lastState = false;
    function SetChecked(val){
           dml = document.forms['searchForm'];
           len = dml.elements.length;
           for( var i = 0; i < len; i++){
                  if (dml.elements[i].name=='view')
                  {
                         dml.elements[i].checked=val;
                  }
           }
           dml.selectAll.checked = val;
    }   
    function toggleSelectList() {
           lastState == false ? SetChecked(true) : SetChecked(false);
           lastState = lastState == true ? false: true;
    }
</script>

This will toggle the checked value of the checkboxes.

enjoy,

larry

--
Larry C. Lyons
Web Analyst
BEI Resources
American Type Culture Collection
email: llyons(at)atcc(dot)org
tel: 703.365.2700.2678
--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:218435
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to