including js file within another js file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gemguy
    New Member
    • Apr 2007
    • 12

    including js file within another js file

    Hi

    I have two .js files namely js1 and js.2. I want to include js1 file within js2 file. Is it possible. I tried with document.write( "<script src="abc.js">.. ...</script>"). Let me have any solutions.

    Gemguy
    ---------------------------

  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    That wouldn't work, you need to escape the quotes.
    [CODE=javascript]document.write( "<script src=\"blah.js\" ><\/script>");[/CODE]

    Comment

    • aussietecho
      New Member
      • Aug 2007
      • 1

      #3
      I had the same issue but all I did was included following statement right at the top of the js file where you want to include this file

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

      Make sure this statement is outside the script tag of this file.....

      Comment

      Working...