View Single Post
  #6 (permalink)  
Old March 2nd, 2007, 08:24 AM
joefawcett's Avatar
joefawcett joefawcett is offline
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Again there are a number of possibilities, you can declare the variable outside the function:
Code:
var geklikt = false;
function clickImg()
{
  if (geklikt)
  {
    //make smaller
  }
  else
  {
    //make bigger
  }
  geklikt = !geklikt;
}
Alternatively test the image width to see if it needs expanding or reducing.
You should try to name your variables and functions more descriptively. Rather than "clicked" perhaps use "isExpanded", in Dutch of course :)

--

Joe (Microsoft MVP - XML)
Reply With Quote