HELP! * GREY=local LOCAL HTML version of Foils prepared 26 February 1996

Foil 15 Example of a JavaScript Function

From CPS616 Lectures on JavaScript CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. by Geoffrey C. Fox * See also color IMAGE

top.setframe("help.html","maindisplay");
function setframe(relativeurldesired,framelabel) {
  • var actualurl = top.baseurl + relativeurldesired;
  • top.frames[framelabel].location.href = this.actualurl;
}
top is a Netscape(Navigator) object with a property frames which is an array labelled by either integers or by value of name attribute in <frame> name="textofframelabel" </frame> tag
Setting a URL into location.href property of a frame loads that page into given frame.
top labels functions defined in page that defines frames
use this.actualurl to distinguish function's variable actualurl from a global variable of same name
Put these functions in <head> </head> section so as to ensure they are loaded before anything else



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 Tue Feb 18 1997