JavaScript Demo:
Including Headers and Footers.
jim.cerny@unh.edu
21-SEP-1998
To maintain flexibility in changing the
format of your Web pages, a useful technique
is to include other files.
Consider
the usefulness of
including a standard header and footer
on a series of files that you may want to redesign
from time to time. If you include a header
and footer file, all you need to do is to
edit those two files to effect the changes
on all your pages.
This page is an example of that technique, using
JavaScript, for what are called "client-side
includes," i.e., the header and footer are called and inserted
by your browser as it displays the Web page.
An alternative is what are called
"server-side includes," i.e., where the Web server
assembles what appears to be a single Web page
to your browser; the Apache Web server used for
UNHINFO supports server-side includes, but we've
disabled that feature for security reasons.
To understand this technique, look at the source
code for this file and read the following notes.
Caveat:
Using your browser to display source code that contains
embedded JavaScript is often difficult.
With Netscape 4.x the "View-->Page Source"
command shows the the resulting HTML source file after the
include takes place, while with Internet Explorer 4.x
the "View-->Source" command
shows the source file as-is,
without the resulting merger that is displayed
on-screen. For the JavaScript files, Netscape
4.x shows the resultant code, not the actual
JavaScript, while Internet Explorer by default
wants to save the code to disk.
For these reasons, has a link to a list of
all the code.
|