How to get the object ids of all the tables and use them to invoke a function of the object.

Discussion in 'Javascript' started by Eshrath Ali Khan, Nov 8, 2004.

  1. Hi,

    I have a requirement where I am creating table object with different
    ids using XSL by taking an XML as input. The no of objects (tables) is
    not fixed. I want to write a javascript to invoke all these objects. I
    can pass the number of objects (Tables) available in the documents as a
    parameter to the javascript function. Can you please tell me how to
    invoke all those objects.

    Basically these objects are nothing but a active X controls writte
    in .Net. I need to get the object ids of these objects and invoke a
    function of the object. The function name is DrawTable().

    I am just stating the example for one object, the object name is
    'tablecontrol1' and the javascript I have written is

    <script type="text/javascript">
    function invokeTableControl()
    {
    tablecontrol1.DrawTable();
    }
    </script>

    I want to write a generalized script to invoke all the objects
    (tables) in the document.

    <script type="text/javascript">
    function invokeTableControl(noofobjects)
    {
    for (i=0;i<noofobjects;i++)
    {
    // but i donno what to write here. any ptrs to
    //this would be helpful.
    }
    }
    </script>

    I donno how to invoke all the other objects. In the XSL I would be
    giving the ids of the tables as tablecontrol1,
    tablecontrol2,tablecontrol3,....


    thanks
    -Eshrath.


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Eshrath Ali Khan, Nov 8, 2004
    #1
    1. Advertising

  2. Eshrath Ali Khan

    Joakim Braun Guest

    "Eshrath Ali Khan" <> skrev i meddelandet
    news:418ffbfe$0$14555$...
    >
    > Hi,
    >
    > I have a requirement where I am creating table object with different
    > ids using XSL by taking an XML as input. The no of objects (tables) is
    > not fixed. I want to write a javascript to invoke all these objects. I
    > can pass the number of objects (Tables) available in the documents as a
    > parameter to the javascript function. Can you please tell me how to
    > invoke all those objects.
    >

    <snip>

    Use DOM. Like this (add checks for browser's DOM compatibility):

    var theTables = document.getElementsByTagName("table");

    // theTables is now a loopable array with a length property:
    invokeSomeFunction(theTables.length);

    for(var i = 0, max = theTables.length; i < max; i++){

    invokeSomeOtherFunction(theTables.id);
    }

    Joakim Braun
     
    Joakim Braun, Nov 9, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anonieko

    HttpHandlers - Learn Them. Use Them.

    Anonieko, Jun 15, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    538
    tdavisjr
    Jun 16, 2006
  2. Replies:
    2
    Views:
    716
    Beat Bolli
    Jun 21, 2005
  3. Chris Brat
    Replies:
    5
    Views:
    709
    =?iso-8859-1?q?Luis_M._Gonz=E1lez?=
    Aug 22, 2006
  4. Stefano Sabatini
    Replies:
    5
    Views:
    287
    Stefano Sabatini
    Feb 5, 2008
  5. why the lucky stiff
    Replies:
    5
    Views:
    154
    why the lucky stiff
    Sep 22, 2004
Loading...

Share This Page