faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

1 of 4 people (25%) answered Yes
Recently 1 of 4 people (25%) answered Yes

Entry

How do i pass the index of my for loop in a function on calling onblur or onclick

Apr 8th, 2008 19:07
ha mo, Dave Clark, Rajesh Manchalwar,


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rajesh,
     I kind of need a bit more information than just that.  The most 
direct answer, of course, is to define your index as a global 
variable.  Then, it can be referenced anywhere, anytime, and by any 
function without hassles.
     Note that a true global variable is one which is defined in the 
HEAD section of your document and is defined outside of any function.  
Also, since a global variable always becomes a property of the 
current "window" object (just as your user-defined functions become 
methods of the current "window" object), you can make absolutely 
certain that your global variables are always true global variables 
just by explicitly attaching them to the current "window" object -- as 
follows:
window.MyGlobalVariableName = "some value";
Take care,
Dave Clark
www.DaveClarkConsulting.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com