Andrew wrote:
Quote:
Well,
>
I've a little trouble that seems unsolvable. It's a stupid question
that born because IE doesn't respect the standard as its usual.
The first part is due to an issue of implementation where there is
nothing to explicitly say how things should work. The second part is
about closures.
[...]
Quote:
The only way I've found to let it work on IE and Firefox too is the
line below.
>
//anchorTag.onclick = function() { "popImage('" + pathImg + "', '" + x
+ "')" }
>
Unfortunately, since the code above is nested into a for ... next loop
the code above not assign the pathImg value and x value to the content
of the in-line function but just a reference, and this cause an obvious
problem. All elements onclick event call through the popImage function
the same image.
Yes, because you have a closure back to pathImg and x, all of the
onclick functions reference back to the same value, which is whatever
they were set to last.
Quote:
Is there a way to solve this. Where am I doing mistake?
There is a thread here that will help with both questions:
Subject: function syntax question
<URL;
http://groups.google.com.au/group/co...0caf593c683e27--
Rob