View Single Post
  #4 (permalink)  
Old Dec 20th, 2007, 05:53
Rakuli's Avatar
Rakuli Rakuli is offline
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: on selecting this radio button, set the class of this div to this

LOL, sorry, I normally comment my examples...

The function takes two arguments, the id of a HTML element and the name of the class that this element will receive.

Within the function, the first line is storing a reference to the html element with the next line setting the className property to the given class.

The HTML code contains a ternary function call esentially, when the radio button is clicked, it checks whether that click has resulted in the radio button being selected. If it has, it runs the function giving it an element id and a class name. If it turns out that this click has resulted in the radio not being checked any longer, nothing happens.

Hope that makes it a bit clearer.
Reply With Quote