473,383 Members | 1,717 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Generating onblur funcations

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?
Dec 13 '07 #1
4 1325
bo*******@gmail.com wrote:
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 :)
Dec 13 '07 #2
On Dec 14, 4:18 am, botski...@gmail.com wrote:
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#
>

--
Rob
Dec 14 '07 #3
On Dec 13, 12:30 pm, Stevo <ple...@spam-me.comwrote:
botski...@gmail.com wrote:
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.
Dec 14 '07 #4
On Dec 13, 8:58 pm, RobG <rg...@iinet.net.auwrote:
On Dec 14, 4:18 am, botski...@gmail.com wrote:
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...browse_frm/thr...

--
Rob
Thanks - that works elegantly.
Dec 14 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Barry Svee | last post by:
I'm struggling with the JavaScript blur event. I have an activex control that I need to interact with when a window loses focus, namely to instruct it to give up control of a barcode scanner so...
1
by: Tzachi | last post by:
Hello all, I have a function that dynamically adds rows and columns to the page. Everything works well except onfocus // onblur attributes. For some reason, when entering the input box it...
2
by: D. Alvarado | last post by:
Hi, I'm having some trouble with the "onBlur" event in the BODY tag. Ideally, what I want to happen is that when someone leaves window A, window A executes a command. I had put <body...
6
by: rob | last post by:
Hi I'm trying to create a "roll-up" effect when a window loses focus and then "roll-down" when it regains focus. This statement works properly with every browser I can get my hands on EXCEPT...
5
by: Dave Hammond | last post by:
Hi All, I have a web form which performs certain actions upon moving focus away from a field. However, if the user clicks the top corner 'X' icon to close the window, the onBlur event still...
3
by: Robert Oschler | last post by:
I have a textarea element that I have created an onblur() handler for. In the onblur() handler, I check to make sure that they have saved the contents of the edit box, before leaving it. If...
1
by: neil S via DotNetMonster.com | last post by:
I have a custom control with a textbox and dropdown list. The dropdown list is hidden and acts as a data source for the textbox. When the user enters text in the textbox, an onKeyup event is...
1
by: Duncan | last post by:
Hi all, I'm tearing my hair out on this! I have a simple ASP.NET 2 page with a TextBox control, in the PreRender I set ClientSide events:- Response.Attributes.Add("onchange",...
4
by: rubenhan | last post by:
Hey, guys. My basic idea is this. When I write "1" in the pre-existing text field and onblur, I want to add a new field with a set of attributes, which turned out to be the same as the pre...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.