Inclusion of another file into an existing one

M

martin weinberger

Hello all,

I have what is hopefully a simple question. I tried using a link statement
but for whatever reason is not working for me. I have my main webpage, call
it 'Test1.htm'. Inside of the file (page) I would like to "include", to use
a C/C++ terminology, some code located in a different file. Here is a
fragment:

**** Test1.htm ****

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<head>
<title>My Test Page</title>

<script language="Javascript">
ButtonFolder="../Buttons/";
</script>

<link href="../Buttons/BVBtn_Header.html" rel="Next" type="text/html" />
</head>

<body>

<a href="http://www.butterflyvista.com/"
onMousedown="ActiveImage('bvbtn_buynow')"
onMouseOver="ActiveOverImage('bvbtn_buynow')"
onMouseout="InActiveImage('bvbtn_buynow')"><img
src="../Buttons/bvbtn_buynow_up.gif" width="197" height="37" border="0"
alt="Buy Now" name="bvbtn_buynow"></a>
</body>

**** BVBtn_Header.html ****
<script language="JavaScript">

// JavaScript code codes here

</script>

If I include the file manually inside the main HMTL page, then everything
works. My problem is breaking the code up into two files. I thought that the
link statement

<link href="../Buttons/BVBtn_Header.html" rel="Next" type="text/html" />

would work, but it doesn't or I code it improperly. I'd appreciate any help
that you all can provide. Thanks in advance,
 
D

David Dorward

martin said:
I have my main webpage, call it 'Test1.htm'. Inside of the file (page) I
would like to "include", to use a C/C++ terminology, some code located in
a different file.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<head>
<title>My Test Page</title>

<script language="Javascript">

You have syntax errors said:
If I include the file manually inside the main HMTL page, then everything
works. My problem is breaking the code up into two files. I thought that
the link statement

<link href="../Buttons/BVBtn_Header.html" rel="Next" type="text/html" />

would work, but it doesn't or I code it improperly. I'd appreciate any
help that you all can provide. Thanks in advance,

That states that the next document in the sequence is
.../Buttons/BVBtn_Header.html, supporting browsers (including lynx, Netscape
and Opera, but not MSIE) generally present such links to the user as a
toolbar. It isn't a means to merge an external file into the current
document.
 
M

martin weinberger

Hi David and Group,

How do I go about merging an external file (which contains JavaScript code
embedded between a <script> ... </script> tags) into the current (.htm)
document?

Thanks in advance.
 
M

Michael Wilcox

martin weinberger said:
How do I go about merging an external file (which contains JavaScript
code embedded between a <script> ... </script> tags) into the current
(.htm) document?

A server-side language like SSI or PHP would do nicely.
 
M

martin weinberger

Hi David!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

I added this line that you recommended and it works!!!!!! Yippee!!!!!
Yahoo!!!!! AltaVista & Google too! (little joke there :))

That was the exact solution that I was looking for.

<script type='text/javascript' src='../Buttons/BVBtn_Header.js'>

Thanks a million!!!!!!
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top