View Full Version : find function that scattered in document

01-12-2003, 02:06 PM
is there any way to find say the second function call in document ,what i mean is
say you have the function foo() , and then you have this function call scattered in the document
in different places , but i like to get access to the second (instance?? ) of the function in document
( the reason by the way is to get the third argument value of this second instance of the foo() function call in the page
is there any kind if array of functions or collection in page?

01-12-2003, 10:52 PM
You can't have two functions named foo(). If you define two on the same page, the second function will override the first.

As for the rest of your question, functions are not listed by index, but they are listed by name (along with global variables) in the window[] hash table. So, for example,


is a completely valid function call, assuming a function foo exists.

01-13-2003, 08:54 AM
well this is not exactly what i meant (sorry for my poor English)
i mean say i have table with 3 rows
<tr onclick=foo()>
<tr onclick=foo()>
<tr onclick=foo()>
and then i have 2 more foo() calls in the page body
something like : <p onclick=foo()> , <p onclick=foo()>
now this page is generated from third party application so i can't know how many rows it will create with the foo() call
and how many <p> it will create with the foo() call.
so if i understood you right there is no way to access the functions by index ?