简体   繁体   English

JavaScript:如何在标签之间切换?

[英]JavaScript: how to switch between tabs?

So I created some tab using XUL. 因此,我使用XUL创建了一些标签。 How can I write JavaScript code so that if I click on a button in tab 1, tab 2 will be shown? 如何编写JavaScript代码,以便如果单击选项卡1中的按钮,将显示选项卡2?

Get the tabs element and set the selected Index property to the index of the tab you want. 获取tabs元素, 并将选定的Index属性设置为所需标签的索引。 eg if the tabs element is 'mytabs' and you want to select the 2nd tab... 例如,如果tabs元素是“ mytabs”,并且您想选择第二个标签...

document.getElementById("mytabs").selectedIndex = 1;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM