Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Sep 2002
    Posts
    143
    Thanks
    0
    Thanked 0 Times in 0 Posts

    find function that scattered in document

    Hello
    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?
    thanks!

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Location
    USA
    Posts
    151
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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,

    window['foo']();

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

  • #3
    Regular Coder
    Join Date
    Sep 2002
    Posts
    143
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 ?
    thanks


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •