Results 1 to 4 of 4

Thread: js include file

  1. #1
    Hi

    Than i include js file in the script tag and putting additional script code directly
    (like this: <script src="file.js> js content </script>)
    i receive error, however if i include js file and leave script tag empty, script works fine.
    What is the problem?

    Thanks.

  2. #2
    Member Spudhead's Avatar
    Join Date
    May 2000
    Location
    over there
    Posts
    428
    bit difficult to say without seeing rest of code (and I'm none too hot myself but is it because you haven't got a closing quote after the filename? Try:

    <script src="file.js"></script>

    Hope this helps..

    BW

  3. #3
    i don't think when you are calling an external js file you can put anything between the script tags.. i'm not sure.. but i dont think you can.
    Bman ({-';'-})
    "Ernest Hemingway once wrote, 'The world is a fine place, and worth fighting for.' I agree with the second part."

  4. #4
    Hi Lokiz:

    As bman correctly notes, you cannot put any code between your <script src>-tags.
    If you want to use an include and then add some code only for use in that particular page, you simply add another pair of <script>-tags.

    For example:

    <html>
    <head>
    <script src="externalScript.js"></script>
    <script type="text/javascript">
    //some code
    </script>
    <head>
    <body>
    </body
    </html>

    Hope that helps
    Michel.P
    Michel.P

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. SSI include file help
    By mrdeleigh in forum Server-side technologies
    Replies: 1
    Last Post: 17th July 2012, 22:56
  2. Problem with file, file_get_contents and include in PHP 5
    By Debbie-Leigh in forum Server-side Forum
    Replies: 3
    Last Post: 6th February 2008, 00:34
  3. SSI: Placement of file to include
    By Lady_Aleena in forum Server-side Forum
    Replies: 2
    Last Post: 30th April 2005, 14:43
  4. global.asa vs include file
    By Vera L. C. Pincerato in forum Server-side Forum
    Replies: 6
    Last Post: 13th January 2002, 00:24
  5. Include file
    By Vera L. C. Pincerato in forum Server-side Forum
    Replies: 5
    Last Post: 24th July 2001, 21:42

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •