Forum Moderators: phranque
I have a long javascript file in the head of my HTML homepage I would like to link to externally, making SEs lives easier.
Not sure what I am doing wrong but it is not working.
Could someone help me get this right, starting with the proper link from homepage. where to put it, additional code in the body, etc?
The js file handles lots of rollovers and also it has been tweaked so that windows which open in a new browsers, remain open even after links on them have been selected (like an open menu).
The page also has applets with parameters which I would like to link to externally, making the file a lot smaller...
Thank you!
If the external js file is in the same directory you should not have a problem. However, if it's in a different directory than the page calling it you probably have to tweak some of the url references to reflect its new location as that's where the file is being run from. (Does that make sense?)
If that's still a problem try replacing any relative references with full urls and work backswards from there.
In the head of the html file:
<script language="javascript" src="path_to/external_file.js"> </script>
NB, the .js file does not need any <script> tags; just the code.
> additional code in the body
Only any that may be needed inline; events to call functions for instance.
More:
[webmasterworld.com...]
[webmasterworld.com...]
*Don't forget the Site Search facility at the top of every page at Webmasterworld!
T