JQuery tab control from adjacent/sibling frame (not iframe)
I am using the JQuery UI (1.7.3) to implement tabs. I would like to make a specific tab active via a button in an adjacent/sibling frame (not iframe). The control script lives in a 'menu-banner' frame and the tabs reside in a frame called 'main'. Without frames this would be accomplished by a command similar to this, '$("#myTabs").tabs("enable", 1)'. So far nothing I've tried works.
Here are some experiments with various DOM syntax:
//parent.frames[0].$("#tabs").tabs("enable", 3);
//parent.frames[1].$("#tabs").tabs("enable", 3);
//$('#tabs', window.parent.frames[1].document).tabs("enable", 3); <!-- frames array only works with iframes. Try selector frame[name = 'main'] instead.-->
//$('#tabs', window.parent.main.document).tabs("enable", 3);
//$('#tabs', window.parent.frames['main'].document).tabs("enable", 3);
//$('#tabs', parent.frames['main'].document).tabs("enable", 3);
//$("#tabs", top.frames["main"].document).tabs("enab开发者_Python百科le", 3);
//window.parent.frames[1].$("#tabs").tabs("enable", 3);
//$('#tabs', window.frames["main"]).tabs("enable", 3);
//window.frames["main"].$("#tabs").tabs("enable", 3);
//window.parent.document.frames["main"].$("#tabs").tabs("enable", 3);
//top.frames[1].$(#tabs").tabs("enable", 3); <!-- This is just bad, hangs. -->
//parent.main.document.$("#tabs").tabs("enable", 3); <!-- parent.main.document.$ is not a function -->
//$('#tabs', parent.main.document).tabs("enable", 3);
//($"#tabs", window.frames["main"].document).tabs("enable", 3); <!-- This is just bad, hangs...'renderContent() is not defined' -->
$('#tabs', window.parent.frames[name = 'main']).tabs("enable", 3);
Most times, these efforts fail silently. Thanks for any help you can provide.
After a little more experimentation, I found the correct syntax to programatically select a specific tab from a sibling frame:
top.main.$("#tabs").tabs("select", 3);
精彩评论