JavaScript Tip of the Week for June 3, 1996: Source Code: Moving Around in Frames the Easy Way: With JavaScript

Jump to source of:


Source code for Frame Setup:
<FRAMESET COLS = "225,*">
<FRAME NAME = "a" SRC = "side.html">
        <FRAMESET ROWS = "*,70">
        <FRAME NAME = "b" SRC = "main01.html">
        <FRAME NAME = "c" SRC = "bottom.html">
        </FRAMESET>
</FRAMESET>



Source code for Frame Loading:
function start(){
        parent.frames[0].location = "toolbar.html";
        parent.frames[1].location = "main02.html";
        parent.frames[2].location = "bottom_nav.html";
        }



Source code for Forward, Back, and Jump Functions:

Use this to go one level back:
parent.frames[1].history.back()
Use this to go one level forward:
parent.frames[1].history.forward()
Use this function for frame jump:
var num = 0;
function jump(){
        parent.frames[1].history.go(num);
        }
Use this HTML to create form for jump, using image button to activate:
<A HREF = "JavaScript:jump()">
<IMG HEIGHT = 28 WIDTH = 84 BORDER = 0 SRC = "image_name"></A>
<FORM>
<INPUT NAME = "Jump" TYPE = "radio"
 onClick = "num = -2">-2
<INPUT NAME = "Jump" TYPE = "radio"
 onClick = "num = -1">-1
<INPUT NAME = "Jump" TYPE = "radio"
 onClick = "num = 1">+1
<INPUT NAME = "Jump" TYPE = "radio"
 onClick = "num = 2">+2
</FORM>