Including HTML files within another HTML file

R

Ralf Koms

Hi,

I would like to reference some other HTML files within an "main" HTML file
(within the "header"),
Something like this:

<link rel="part1" href="file1.htm">
<link rel="part2" href="file2.htm">
<link rel="part3" href="file3.htm">

etc.

I would then like to include (within the BODY section) the HTML code of the
referenced pages within the "main" HTML file.

E.g. in a table:

<table>
<tr>
<td>
Code of file1.htm
</td>
</tr>
<tr>
<td>
Code of file2.htm

etc.

My idea was to fetch via

document.getElementsByTagName("link") or
document.getElementsByID(...)

the appropriate objects and to iterate over them.
But how can I then write out the actual code contained in the HTML parts I
want to include ?
Is there sth. like "write.out()" ?

Or is there an even easier way ?

Thanks...
 
R

Randy Webb

Ralf said:
Hi,

I would like to reference some other HTML files within an "main" HTML file
(within the "header"),
Something like this:

<link rel="part1" href="file1.htm">
<link rel="part2" href="file2.htm">
<link rel="part3" href="file3.htm">

Easily done using Server Side Includes, or any other Server Side
Mechanism to include files.
etc.

I would then like to include (within the BODY section) the HTML code of the
referenced pages within the "main" HTML file.

E.g. in a table:

<table>
<tr>
<td>
Code of file1.htm
</td>
</tr>
<tr>
<td>
Code of file2.htm

etc.

My idea was to fetch via

document.getElementsByTagName("link") or
document.getElementsByID(...)

the appropriate objects and to iterate over them.
But how can I then write out the actual code contained in the HTML parts I
want to include ?

Not very easily.
Is there sth. like "write.out()" ?
No.

Or is there an even easier way ?

Yes. Do it on the server.
 
R

Ralf Koms

Randy Webb said:
Easily done using Server Side Includes, or any other Server Side
Mechanism to include files.


Not very easily.


Yes. Do it on the server.

--

The thing is I need a solution not doing this with a server-side script
language.
I also do not want to use IFrames/Frames.
So what are the possible ways ?
 
R

Randy Webb

The thing is I need a solution not doing this with a server-side script
language.
I also do not want to use IFrames/Frames.
So what are the possible ways ?

Use an HTTP Request object, then create nodes, and insert the text/html
into those nodes. Then ask why it only works in IE and Mozilla. Consult
the FAQ on how to accomplish the HTTPRequest Object. And then, depending
on what is in the HTML files, you may just have to eval it <shudder> if
it contains JS code.
 
R

Ralf Koms

Randy Webb said:
Use an HTTP Request object, then create nodes, and insert the text/html
into those nodes. Then ask why it only works in IE and Mozilla. Consult
the FAQ on how to accomplish the HTTPRequest Object. And then, depending
on what is in the HTML files, you may just have to eval it <shudder> if
it contains JS code.

What do you mean by "nodes" ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top