On Jun 7, 4:40 pm, Andrea Fineschi <[email protected]> wrote:
> Mmmm.. this is an example:
>
> <div id="a"></div>
> <div id="b"></div>
> <div id="c"></div>
> <div id="d"></div>
>
> I have 3 div. I can edit one of this using  - var hello[X] =
> document.getElementsByTagName('div') -
> If i want to edit the first, X=0
> If i want to edit the second, X=1
> If i want to edit the third, X=2
> If i want to edit the fourth, X=3
>
> I want to know the number "X" using Firebug. X is the position in the
> array (hello[]) :)

I am still unsure if I am actually answering the right thing :) but,
you can use the Firebug Inspector to select your <div> on the page and
consequently use '$0' variable on the Firebug command line.

This variable refers to the last inspected element.
See more: 
http://www.softwareishard.com/blog/planet-mozilla/firebug-tip-inspector-history-command-line/

And if this is not enough and you really need that index you can type
something as follows into the command line:

var nodes = $0.parentNode.children;
for (var i=0; i<nodes.length; i++)
{
  if (nodes[i] == $0)
      console.log(i);
}

Honza

>
> Sorry sorry sorry for my bad english ><

-- 
You received this message because you are subscribed to the Google Groups 
"Firebug" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/firebug?hl=en.

Reply via email to