RE: feeling stupid....

"Lon Boonen" <[email protected]>
Newsgroups gmane.comp.web.dom.wdf
Message-ID <[email protected]>
put it in some method where num is not changed...

attachClickHandler(el1, 1};
attachClickHandler(el2, 2};
attachClickHandler(el3, 3};

function attachClickHandler(el, num)
{
  el.onclick = function() {deleteRow(this,num);return false;};
}




-------------------------------------------------
Q42:   http://www.q42.nl
Xopus: http://xopus.com




> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Seb Frost
> Sent: dinsdag 3 januari 2006 12:47
> To: [email protected]
> Subject: [wdf-dom] feeling stupid....
> 
> 
> 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
> 
> 
> 
>  
> 
> 
> 


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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.