Inclusion of another file into an existing one

Discussion in 'HTML' started by martin weinberger, Nov 28, 2003.

  1. 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,

    --
    Martin A. Weinberger
    ButterflyVista
    http://www.butterflyvista.com/
    (when responding to me by email, remove the "X_" from the beginning)
     
    martin weinberger, Nov 28, 2003
    #1
    1. Advertising

  2. martin weinberger wrote:

    > 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.


    <http://www.allmyfaqs.com/faq.pl?Include_one_file_in_another>

    > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    >
    > <head>
    > <title>My Test Page</title>
    >
    > <script language="Javascript">


    You have syntax errors, try <http://validator.w3.org/>

    > 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.

    --
    David Dorward http://dorward.me.uk/
     
    David Dorward, Nov 28, 2003
    #2
    1. Advertising

  3. 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.

    --
    Martin A. Weinberger
    ButterflyVista
    http://www.butterflyvista.com/
    (when responding to me by email, remove the "X_" from the beginning)
     
    martin weinberger, Nov 28, 2003
    #3
  4. martin weinberger wrote:

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


    <script type='text/javascript' src='/uri/of/file.js'>
    /* JavaScript for browsers which don't support external script files (not
    that there are many of them! */
    </script>

    <http://www.w3.org/TR/html4/interact/scripts.html#h-18.2.1>

    --
    David Dorward http://dorward.me.uk/
     
    David Dorward, Nov 29, 2003
    #4
  5. martin weinberger <> wrote:
    > 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.
    --
    Michael Wilcox
    mjwilco at yahoo dot com
    Essential Tools for the Web Developer - http://mikewilcox.t35.com
     
    Michael Wilcox, Nov 29, 2003
    #5
  6. 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!!!!!!

    --
    Martin A. Weinberger
    ButterflyVista
    http://www.butterflyvista.com/
    (when responding to me by email, remove the "X_" from the beginning)
     
    martin weinberger, Nov 29, 2003
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. nrm
    Replies:
    3
    Views:
    535
  2. loveNUNO
    Replies:
    2
    Views:
    926
    loveNUNO
    Nov 20, 2003
  3. Robert Cohen
    Replies:
    3
    Views:
    279
    Andrew Durstewitz
    Jul 15, 2003
  4. Replies:
    0
    Views:
    192
  5. ddtl
    Replies:
    2
    Views:
    80
Loading...

Share This Page