问题
This code is not working, how do i switch the focus on a tab. Is there another way?
var tabOne;
tabOne = "CODE:";
tabOne += "TAB T=1";
iimPlay(tabOne);
回答1:
I figured it out...
var mainWindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
.QueryInterface(Components.interfaces.nsIDocShellTreeItem)
.rootTreeItem
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindow);
function TabLeft()
{
mainWindow.gBrowser.tabContainer.advanceSelectedTab(-5, true);
return "True";
}
TabLeft();
回答2:
The code is:
var tabOne;
tabOne = "CODE:";
tabOne = "TAB OPEN"+"\n";
tabOne += "TAB T=2"+"\n";
iimPlay(tabOne);
OR
var tabOne;
tabOne = "CODE:";
tabOne += "TAB T=1"+"\n";
iimPlay(tabOne);
I am interested to know what does your code do.
来源:https://stackoverflow.com/questions/27837578/change-focus-on-tab-javascript-imacros