Results 1 to 6 of 6

Thread: Problems referencing external .js includes

  1. #1
    Join Date
    Dec 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Problems referencing external .js includes

    Hi,
    I am having a problem with includes. Specifically, I tried to include the "No right click script III (no alert)" script on a page. When the code is in the page it works fine, however I have over 200 pages I need to insert it into.

    I though **No problem, just create and external JS Library file and I'll be done in time for supper** <-- That was the first problem - being cocky towards a computer!

    However I copied the JS into a file (removing the <script></script> tags, and leaving the copyright notice intact, the file doesn't work. I used the line <script type="text/javascript" src="js/click.js"> Copyright.... </script> in the <HEAD> section but it doesn't work now. If I drop the JS back into the HTML file - presto it works!

    Weird though is that I tried the samething with Lightboox 2.03 (using the includes) and everything works fine.

    Any thoughts? I can't post a link because I haven't uploaded the page yet - it's a mess now!

    BTW, I am doing the design in Frontpage 2003, if that makes any heehaw.

    Thanks,
    Tim
    Last edited by timveer; 12-14-2007 at 02:46 AM. Reason: Clarify title, clearer explanation

  2. #2
    Join Date
    Mar 2007
    Location
    Tarboro, NC
    Posts
    290
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default

    Code:
    <script type="text/javascript" language="JavaScript" src="js/click.js">
    </script>
    And be sure to use the ../ after you get inwards, or else you'll be right back. Lol. I think that should fix it anyways.

  3. #3
    Join Date
    Dec 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Tim,
    Actually the problem still exists even if I haven't moved any files, moved inwards, etc...

    I am wondering if there is maybe something in the JS code that prevents it from being read/invoked properly? I am pretty new to JS, my head is already pounding away just getting this far...

    Thanks,
    Tim

  4. #4
    Join Date
    Dec 2007
    Location
    Ankara, Turkey
    Posts
    160
    Thanks
    2
    Thanked 2 Times in 2 Posts

    Default

    Can you provide a link to the problematic page?

  5. #5
    Join Date
    Mar 2007
    Location
    Tarboro, NC
    Posts
    290
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default

    I mean't adding the
    Code:
    Language="JavaScript"
    to your tags. I had something similar one time, and that fixed it.

  6. #6
    Join Date
    Dec 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    timveer, is there a possibility the copyright text you have between the <script> & </script> tags is generating an error?

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

    Make sure the text is displayed as...

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

    // Copyright....

    </script>


    or

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

    /*
    Copyright....
    */

    </script>


    Send a link to your page and someone should be able to sort it out for you.

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
  •