Change focus on tab javascript imacros

爷,独闯天下 提交于 2019-12-12 03:15:27

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!