Connecting Tech Pros Worldwide Forums | Help | Site Map

Generating onblur funcations

botski007@gmail.com
Guest
 
Posts: n/a
#1: Dec 13 '07
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?
Stevo
Guest
 
Posts: n/a
#2: Dec 13 '07

re: Generating onblur funcations


botski007@gmail.com wrote:
Quote:
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 :)
RobG
Guest
 
Posts: n/a
#3: Dec 14 '07

re: Generating onblur funcations


On Dec 14, 4:18 am, botski...@gmail.com wrote:
Quote:
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/co...0278e9f?hl=en#
Quote:
>

--
Rob
botski007@gmail.com
Guest
 
Posts: n/a
#4: Dec 14 '07

re: Generating onblur funcations


On Dec 13, 12:30 pm, Stevo <ple...@spam-me.comwrote:
Quote:
botski...@gmail.com wrote:
Quote:
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 :)
OK - I'm ready to see the eval() solution. Thanks.
botski007@gmail.com
Guest
 
Posts: n/a
#5: Dec 14 '07

re: Generating onblur funcations


On Dec 13, 8:58 pm, RobG <rg...@iinet.net.auwrote:
Quote:
On Dec 14, 4:18 am, botski...@gmail.com wrote:
>
Quote:
We have a loop that calculates
argValue = someIntegerValue;
component.onblur = function() { callFun( this, argValue ) };
loop
>
Quote:
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.
>
Quote:
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 ) };
>
Quote:
Any ideas?
>
I think this thread will answer your question:
>
"Adding events in a loop with arguments"
<URL:http://groups.google.com.au/group/co...browse_frm/thr...
>
>
>
--
Rob
Thanks - that works elegantly.
Closed Thread