Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Determining Which Tab is Selected in XUL Dialog

1 view
Skip to first unread message

J Paul Richardson

unread,
Dec 19, 2009, 6:47:05 PM12/19/09
to dev-te...@lists.mozilla.org
I've been experimenting with tabs in a XUL dialog. I have two tabs
(let's call them A & B) and want to perform an action based on which tab
is active (ie - which one I'm looking at). How do I determine which tab
is the active one?

I've tried working with selectedIndex, selectedItem and selectedTab but
can't seem to get anything beyond "undefined."

Vasu

unread,
Dec 20, 2009, 6:10:51 AM12/20/09
to
You may want to check this out

https://developer.mozilla.org/en/Code_snippets/Tabbed_browser

Refer to 'Reusing by other criteria' section. This might do the trick
for you.

reverendlinxu

unread,
Dec 20, 2009, 1:42:20 PM12/20/09
to
Thanks for the lead. I checked that out and although it didn't work
for me, it did get me past my roadblock and on to the solution.
Here's the test code that worked out for me.

var tabs = document.getElementById("TabList");

if( tabs.selectedIndex == 0 ) {
alert("Tab A Selected");
} else {
alert("Tab B Selected");
}

Again, thanks for the push in the right direction.

Vasu

unread,
Dec 21, 2009, 6:24:33 AM12/21/09
to
Glad it worked for you
0 new messages