an onClick function

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

an onClick function

Post 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
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Post 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
Post Reply