I recently wrote an app where I had to do just this sort of thing. I found frequent posts on the internet but none quite worked for me. Here is what I ended up using that did work.
Variables I declared in the main index/frameset code.
<script>
// Global Variables
var index = -1;
var panes = 0;
var panesHeight=0;
var pageMode=1;
var zoomLevel=-2;
</script>
</head>
<frameset cols="150,*" border="1" bordercolor="#ffffff">
<frame name="leftNav" src="sidebar.html">
<frameset rows="*,80" border="1" bordercolor="#ffffff" >
<frame name="main" src="main.html" noresize scrolling=auto marginheight=5 marginwidth=5><frame name="pagenav" src="nav.html" noresize scrolling=no marginheight=5 marginwidth=5>
</frameset>
</frameset>
Then used things like this I needed to store variables AND access frames. This workes quite well and worked with jQuery well. I'm interested in the responses since I'd like to clean this code up if possible.
if (window.parent.pageMode == 1) {
$('#left', window.parent.frames['main'].document).html('<img border="0" src="' + window.parent.pages[window.parent.index + 1].image + '" width="' + zoom + '" onclick="if(window.parent.pageMode==1){nextPage();showPages();}" style="cursor:e-resize;" >');
}else{ // mode 0
$('#left', window.parent.frames['main'].document).html('<img border="0" src="' + window.parent.pages[window.parent.index + 1].image + '" width="' + zoom + '" align="right" onclick="if(window.parent.pageMode==0){prevPage();showPages();}" style="cursor:w-resize;" >');
$('#right', window.parent.frames['main'].document).html('<img border="0" src="' + window.parent.pages[window.parent.index + 2].image + '" width="' + zoom + '" align="left" onclick="if(window.parent.pageMode==0){nextPage();showPages();}" style="cursor:e-resize;" >');
}