including files

Discussion in 'Javascript' started by windandwaves, Aug 31, 2006.

  1. windandwaves

    windandwaves Guest

    Hi Folk

    This seems like a really stupid question. Can you include a javascript
    file in a javascript file?

    Rather than doing this:

    <script src="A"></script>
    <script src="B"></script>

    I want to do

    <script src="A"></script>

    and then have in script A:

    include("B");

    where include is a magic word that includes the file B.

    Thanks in advance

    Nicolaas
    windandwaves, Aug 31, 2006
    #1
    1. Advertising

  2. windandwaves

    Angel Guest

    windandwaves wrote:
    > Hi Folk
    >
    > This seems like a really stupid question. Can you include a javascript
    > file in a javascript file?
    >
    > Rather than doing this:
    >
    > <script src="A"></script>
    > <script src="B"></script>
    >
    > I want to do
    >
    > <script src="A"></script>
    >
    > and then have in script A:
    >
    > include("B");
    >
    > where include is a magic word that includes the file B.
    >
    > Thanks in advance
    >
    > Nicolaas



    Add the following statement in the first javascript file

    document.write('<script language="javascript" src="B.js"></script>')


    HTH,
    Angel
    Angel, Aug 31, 2006
    #2
    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. MS News \(MS ILM\)
    Replies:
    1
    Views:
    417
    Scott Schluer
    Aug 19, 2003
  2. Xavier MT
    Replies:
    1
    Views:
    589
    Scott Schluer
    Aug 19, 2003
  3. farmer

    "Including" multiple files?

    farmer, Aug 2, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    571
    farmer
    Aug 2, 2005
  4. Raman
    Replies:
    5
    Views:
    353
    Lew Pitcher
    Jun 7, 2008
  5. Nathan Beyer
    Replies:
    0
    Views:
    105
    Nathan Beyer
    Nov 15, 2009
Loading...

Share This Page