Generating onblur funcations

B

botski007

We have a loop that calculates
argValue = someIntegerValue;
component.onblur = function() { callFun( this, argValue ) };
loop

The problem is that the onblur call is exactly "callFun( this,
argValue )" for every component so that the last value of argValue
gets passed to every component.

What we want is this. Assume, for one iteration, argValue had a value
of 16. We want to generate this:
component.onblur = function() { callFun( this, 16 ) };

Any ideas?
 
S

Stevo

We want to generate this:
component.onblur = function() { callFun( this, 16 ) };
Any ideas?

I have one but it involves eval so I'll wait to see if anyone gives the
proper solution :)
 
R

RobG

We have a loop that calculates
argValue = someIntegerValue;
component.onblur = function() { callFun( this, argValue ) };
loop

The problem is that the onblur call is exactly "callFun( this,
argValue )" for every component so that the last value of argValue
gets passed to every component.

What we want is this. Assume, for one iteration, argValue had a value
of 16. We want to generate this:
component.onblur = function() { callFun( this, 16 ) };

Any ideas?

I think this thread will answer your question:

"Adding events in a loop with arguments"
<URL: http://groups.google.com.au/group/comp.lang.javascript/browse_frm/thread/cd8acd0900278e9f?hl=en#
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,146
Messages
2,570,832
Members
47,374
Latest member
EmeliaBryc

Latest Threads

Top