SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2006
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    javascript include not working

    here is my include

    Code:
    <script type="text/javascript" src="poo.js"></script>
    when i use this the javascript functions don't work on my site but if I don't use include it works fine.

    (and yes src address is correct)

    I also use php in my pages tho I don't think that would matter

  2. #2
    Chive On FFCus's Avatar
    Join Date
    Feb 2006
    Location
    Connecticut
    Posts
    542
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are there sytanx errors in your .js file? Do you have the <script> tags in the .js file? That'll mess it up.

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2006
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well the functions seem to work when they're not in the .js file so they shoud also work if they're in one right?
    Also it doesn't show any error messages even if there is one.

    and no there isnt' any <script> tags in the .js file

  4. #4
    Chive On FFCus's Avatar
    Join Date
    Feb 2006
    Location
    Connecticut
    Posts
    542
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Vyliss
    well the functions seem to work when they're not in the .js file so they shoud also work if they're in one right?
    Also it doesn't show any error messages even if there is one.

    and no there isnt' any <script> tags in the .js file
    I would certainly think so. I put all of my functions in .js files without issue. Have you tried a script debugger? More on on debuggers about half-way down on this page.

    Posting the code may put a few hundred more eyes on it to help find the issue, if you can do so.

  5. #5
    SitePoint Enthusiast pentapenguin's Avatar
    Join Date
    Aug 2005
    Location
    GA, USA
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You don't have a .htaccess file blocking it do you?

  6. #6
    SitePoint Enthusiast
    Join Date
    Mar 2006
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pentapenguin
    You don't have a .htaccess file blocking it do you?
    no idea

  7. #7
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Post a small example that demonstrates the problem,.e.g. a .js file containing a function that alerts hello, and a page with one <div> on it containing the text "main page" that includes the script, and tries to call the function.

  8. #8
    SitePoint Enthusiast pentapenguin's Avatar
    Join Date
    Aug 2005
    Location
    GA, USA
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Vyliss
    no idea
    Be sure to check that because I've seen that problem before where another file is in a .htaccess protected directory and the browser can't load it.

  9. #9
    Chive On FFCus's Avatar
    Join Date
    Feb 2006
    Location
    Connecticut
    Posts
    542
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is the include file in the same directory as the page calling it?


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
  •