feeling stupid....
"Seb Frost" <[email protected]>
| Newsgroups | gmane.comp.web.dom.wdf |
|---|---|
| Message-ID | <[email protected]> |
num =1;
el1.onclick = function() {deleteRow(this,num);return false;};
num++;
el2.onclick = function() {deleteRow(this,num);return false;};
num++;
el3.onclick = function() {deleteRow(this,num);return false;};
I know this example seems weird and you'll ask why I don't just hardcode the
number in, but this is just me giving the most clear example of the problem
without you having to trawl through the rest of my code!
The problem, as I'm sure you can guess, is that whichever element the user
clicks on (thus invoking "deleteRow"), num is seen as being 3.
What I want is for it to be 1 on the first row, 2 on the second, and 3 on
the third.
How can I pass in the "current" value of num and stop it from using the
"live" value? I thought an eval would do it at first, but soon realised my
mistake and now am not sure how else to do it?
I'd like a solution rather than a workaround to avoid the issue (I can see
several of those) because I'm sure there must be a way to do this!
Cheers
Unsubscribe
[email protected]
List info
http://www.quirksmode.org/dom/list.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/wdf-dom/
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/