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,
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
window.MyGlobalVariableName = "some value";