Basic HTML version of Foils prepared 23 June 1997

Foil 26 Example of a JavaScript Function

From JavaScript Tutorial for Certificate Course UC Web applications Certificate -- Summer 97. by Geoffrey C. Fox, Tom Scavo

Recursion Example
1 top.setFrame("help.html","mainDisplay");
2 function setFrame(relativeURL,frameName) {
3 var actualURL = top.baseURL + relativeURL;
4 top.frames[frameName].location.href =
    • this.actualURL;
5 }
6 top refers to the top-level window in a frameset document. It has a property called frames, which is an array labeled by integers or by name as in <frame> name="frameName" </frame> tag
7 Setting a URL into the location.href property of a frame loads that page into the given frame
8 Use this.actualURL to distinguish local variable actualURL from a global variable of the same name
9 Put these functions in <head> </head> container to ensure they are loaded before anything else

in Table To:


Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Wed Apr 1 1998