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

  • Thread starter Eshrath Ali Khan
  • Start date
E

Eshrath Ali Khan

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.
 
J

Joakim Braun

Eshrath Ali Khan said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top