Page 1 of 1

an onClick function

Posted: Thu Jun 30, 2005 1:10 am
by s.dot
This is most likely pretty simple..

I need a function that when a link or button is clicked, all the checkboxes will become checked

Much like a 'check all' button on a lot of webpage mail systems like yahoo, hotmail etc

Posted: Thu Jun 30, 2005 1:15 pm
by kendall
yo,

usually you have a function that references the items u want to change the property from

Code: Select all

<script>
function Change_Property(){
//  get a reference to the element. usually a form element
var formelement = document.forms&#1111;0].formElementID;
// then change the property or value 
formelement.checked = true; in this case itss a check button
}
</script>
// then apply the function to your links
<a herf=&quote;#&quote; onClick = &quote;Change_Property&quote;>check buttons</a>
make sure your elements have ids
if u want to change the property of more than 1 element u need to reference these elements by id's and relate the property u want to change.
since in your case its a group of check buttons u may want to do a loop throug to check all the check buttons else again u need to reference the buttons whose property u want to change