RE: Including content of one file of HTML in another?

Subject: RE: Including content of one file of HTML in another?
From: "Richard Smith" <Richard -dot- Smith -at- windriver -dot- com>
To: "TECHWR-L" <techwr-l -at- lists -dot- raycomm -dot- com>
Date: Thu, 20 Dec 2001 10:22:39 -0800

To use JavaScript to include, all you do is this:

Step 1: Create a file and name it something sensible, like navbar.js. In
this file, all you need is the following line (although comments would be a
fine idea):
navbar = 'Put your real navbar code here.';

Step 2: In the header of each file you want the navbar to appear in, put the
line:
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"
SRC="./navbar.js"></SCRIPT>

Step 3: In the body of each file you want the navbar to appear in, put this
line where the navbar code would ordinarily be:

<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"><!--
document.write(navbar);
//--></SCRIPT>


This is simple, and there surely are other ways to do it (probably even
better ways to do it with JavaScript). The benefit here is that you only
have one location of the navbar code to edit (much like a library item) but
you can edit it with any text editor. This doesn't require any proprietary
tool, any server side functionality, any real programming skill--as
evidenced by the fact that I did it ;-)


Richard Smith


>
> >Isn't there a way to create a navigation bar and store it in one
> >file, and then have the pages of a website call it from that file
> >and stick it at the top of their content? That would make it a
> >LOT easier to modify the navbar, as you wouldn't have to tweak
> >EVERY PAGE to do it.
>


^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Collect Royalties, Not Rejection Letters! Tell us your rejection story when you
submit your manuscript to iUniverse Nov. 6 -Dec. 15 and get five free copies of
your book. What are you waiting for? http://www.iuniverse.com/media/techwr

Have you looked at the new content on TECHWR-L lately?
See http://www.raycomm.com/techwhirl/ and check it out.

---
You are currently subscribed to techwr-l as: archive -at- raycomm -dot- com
To unsubscribe send a blank email to leave-techwr-l-obscured -at- lists -dot- raycomm -dot- com
Send administrative questions to ejray -at- raycomm -dot- com -dot- Visit
http://www.raycomm.com/techwhirl/ for more resources and info.


Follow-Ups:

References:
Including content of one file of HTML in another?: From: Haas, Guy

Previous by Author: RE: best software for web site development
Next by Author: RE: Including content of one file of HTML in another?
Previous by Thread: Including content of one file of HTML in another?
Next by Thread: RE: Including content of one file of HTML in another?


What this post helpful? Share it with friends and colleagues:


Sponsored Ads