Forgot Password / Register
image
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2003
    Location
    Netherlands
    Posts
    125

    Load js file with javascript

    You can load a js file with the following html:

    <script type="text/javascript" src="script.js"></script>

    I was wondering if you could the same but than from within a js file in stead of in the html. So I mean something like the following:

    page.html:
    ...
    <script type="text/javascript" src="script.js"></script>
    ...

    And then in script.js:

    include("otherscript.js");
    include("secondscript.js");


    Does somebody know some javascript function like that exists?

    Thanks.

  2. #2
    Hi there,

    You are talking about javascript include files, so this is the syntax there's no other official way like in style @import "foo.css" but in javascript there's always a way to go arround and make it work look at this discussion.

    http://www.thescripts.com/forum/thread149165.html

  3. #3
    Join Date
    Oct 2003
    Location
    Netherlands
    Posts
    125
    Thanx this helps alot. sorry for the late reply :$

  4. #4

    Loading JS File From Javascript file

    You can load a Js file from a javascript file by using a variantion of document.write which is document.writeln

    this is how its done

    Code:
    document.writeln("<script src=\"myjavascriptfile.js\" type=\"text\/javascript\" language=\"javascript\"><\/script>")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
image
Copyright © 2009 3D Buzz, Inc. All rights reserved.
Loading Videos...
spinner