View Single Post
  #2 (permalink)  
Old March 1st, 2007, 08:59 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

I would try putting an alert at the start of vergrootImg to make sure it is called at all, or use a debugger if possible. I have found setting onclick with setAttribute doesn't work, I usually just use the onclick property.

For the second part of the problem there are a number of ways, one being to pass "this" a reference to the image:
Code:
img.onclick = function(){vergrootImg(this);};
then modify vergrootImg:
Code:
function vergrootImg(img)
{
  img.setAttribute('width','400px');
  img.setAttribute('height','400px');
}
--

Joe (Microsoft MVP - XML)