View Full Version : Question about linking to a .js file.
07-03-2003, 01:31 PM
I have searched and cannot find a solution to my problem.
Can any of you help me or give some helpful information?
to the file and not have to add every single JS to every page
but when I do so the script(s) in the .js file do not take affect.
The code below is what I used to link to the file:
Any replys would be very helpful.
Thank You in advance! <(^_~)>
07-03-2003, 02:37 PM
07-03-2003, 02:38 PM
I would quess your paths wrong.
Referencing a JS file is the same as referencing a image for example so it may not be nessercary to use the full path.
Put a alert as the first thing in the js file. If it gets loaded then it should alert, just so you can test that its been found
07-03-2003, 03:54 PM
07-03-2003, 04:19 PM
Thanks! You people realy do help a lot!
07-03-2003, 04:23 PM
Something else that I spot is the "()"'s as part of the name of your file...
Not always a problem but, as for naming files usually other than the use of the "_" and/or "&", spaces and other special charactors are usually avoided... Not only does it sometimes cause problems with FSO's but it also makes your code easier to proof read...
Also, bear in mind that if you have any scripts that are object depended (the object must exist for it to modify before the script loads) that it might be best to leave them out of the external .js file, perhaps you can put them in their own external .js and reference them when you need them...
07-03-2003, 04:28 PM
Originally posted by Roy Sinclair
HTML code isn't allowed in the file. That means the <script> tags shouldn't be there and you definitely don't want the <!-- //--> html comment tags either.
To clarify, what Roy means is that using tags as objects within the script is not allowed... However, using tags as part of an output string is perfectly legal...
document.write('<p>Paragraph one...<br //> We hold these truths to be... <br //>You get the idea...<//p>')
07-03-2003, 04:36 PM
Originally posted by arnyinc
Sorry for misleading you. I'm sure seeing an answer under a question also tends to discourage some people from replying.
My only defense is that I didn't proclaim my answer as gospel. I said "I think"!
*smacky smacky* :o
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.