PDA

View Full Version : Problems referencing external .js includes



timveer
12-14-2007, 02:40 AM
Hi,
I am having a problem with includes. Specifically, I tried to include the "No right click script III (no alert)" (http://www.dynamicdrive.com/dynamicindex9/noright3.htm) 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

TimFA
12-14-2007, 03:01 AM
<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.

timveer
12-14-2007, 03:19 AM
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

BYK
12-14-2007, 05:05 AM
Can you provide a link to the problematic page?

TimFA
12-14-2007, 07:12 PM
I mean't adding the


Language="JavaScript"

to your tags. I had something similar one time, and that fixed it.

Lloyd Hassell
12-19-2007, 05:30 AM
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.