atw: Re: How to include another file in an HTML page?

There are various ways to do this. You can use "server side
includes" to nest HTML (or PHP) pages inside others. An easy form of
"client side includes" is to maintain your content as javascript
variables in a side file, and write it on HTML pages by script as
required. (Your text file is still a text file, but it contains
script and
the filename has a .js extension.) Try this example:

1) In a text file saved as contact.js:

contactPerson = "Simon Jenkins";
company = "Fixers Pty Ltd";
addressL1 = "Level 11, 26 O'Connell Street";
addressL2 = "Sydney NSW 2000";
phone = "(02) 9221 2006";
fax = "(02) 9221 1237";
email = "simonj@xxxxxxxxxxxxx";

function writeContactDetails() {
contactDetails = "<menu>" + contactPerson + "<br>";
contactDetails += company + "<br>" + addressL1 + "<br>";
contactDetails += addressL2 + "<br><br>Phone: " + phone;
contactDetails += "<br>Fax: " + fax + "<br>Email: "
contactDetails += email + "</menu>";
document.write(contactDetails);
}

---------------

2) In the Head section of an HTML file in which you intend to
include the contact details:

<script type='text/javascript' src='contact.js'></script>
<!-- assumes the .js file is in the same folder -->

3) At the place in an HTML file where you want the contact details
to appear:

<script type='text/javascript'>writeContactDetails()</script>


------------------------------------------
Peter Bloxsom
http://www.netpublish.net
peter@xxxxxxxxxxxxxx
----- Original Message -----
From: "Stuart Burnfield" <sburnf@xxxxxxxxxxx>
To: <austechwriter@xxxxxxxxxxxxx>
Sent: Thursday, September 08, 2005 1:49 PM
Subject: atw: Re: How to include another file in an HTML page?


>
>
>
>
> Would this (inline frames) do what you want?
>
> http://www.htmlhelp.com/reference/html40/special/iframe.html
>
> Stuart
>
> **************************************************
> To post a message to austechwriter, send the message to
austechwriter@xxxxxxxxxxxxxx
>
> To subscribe to austechwriter, send a message to
austechwriter-request@xxxxxxxxxxxxx with "subscribe" in the Subject
field.
>
> To unsubscribe, send a message to
austechwriter-request@xxxxxxxxxxxxx with "unsubscribe" in the
Subject field.
>
> To search the austechwriter archives, go to
www.freelists.org/archives/austechwriter
>
> To contact the list administrator, send a message to
austechwriter-admins@xxxxxxxxxxxxx
> **************************************************
>
>

**************************************************
To post a message to austechwriter, send the message to 
austechwriter@xxxxxxxxxxxxxx

To subscribe to austechwriter, send a message to 
austechwriter-request@xxxxxxxxxxxxx with "subscribe" in the Subject field.

To unsubscribe, send a message to austechwriter-request@xxxxxxxxxxxxx with 
"unsubscribe" in the Subject field.

To search the austechwriter archives, go to 
www.freelists.org/archives/austechwriter

To contact the list administrator, send a message to 
austechwriter-admins@xxxxxxxxxxxxx
**************************************************

Other related posts: