Hello
This should be a simple thing but I can't get it right. If you look at the source on my website www.montagnaphotography.com I have a js code in the body that begins with the following:
<script>
/*****************************************************************************
Default browsercheck - Leave this one
******************************************************************************/
function lib_bwcheck(){ //Browsercheck (needed)
this.ver=navigator.appVersion; this.agent=navigator.userAgent .........</script>
The script works fine but is long and I want to cut it out of the body and put on a seperate page. I've cut it out, put it as a js.script file and tried referencing it using several codes such as: <script src="http://www.montagnaphotography.com/scripts.js" type=text/javascript></SCRIPT> without any luck. Does anyone have a suggestion how to reference the script correctly?
Could you provide a test page that shows the problem?
Additionally, does your browser throw an error (turn debugging on if you haven't already)? Did you leave the script tags in when you copied the code to a separate file?
An url was already provided: http://www.montagnaphotography.com
There is no javascript error, but the HTML does have errors when passing the page through the http://htmlhelp.com/tools/validator/. Some are related to the script element. Start by fixing those first.
For instance, you have:
<script language=JavaScript1.2 src="coolmenus3.js">">
The correct syntax is:
<script type="text/javascript" src="coolmenus3.js"></script>
(be sure to quote attribute properties, that goes for all attribute values in HTML tags too)
Other script elements in the page don't have a TYPE.
See the HTMLreference for the http://htmlhelp.com/reference/html40/special/script.html
You can link to the different scripts by adding as many such script elements to the page, eg. one for each functionality by copying the script in a text file, like you did for coolmenus3.js. Leave the legal comments together with the corresponding scripts. Then, if someone takes the code, the legal notice will be included with a reference to the original site of that script.
Must be a swedish thing then
That wasn't clear.
Christian, the OP did cut out the coolMenus script by Thomas Brattli (http://www.dhtmlcentral.com/coolmenus/). As I suggested, the same thing can be done for the other scripts taken from elsewhere too. Or it might be that the script doesn't work in a certain browser (which?). I didn't get any error in Safari.
Pandy, no harm done
Now you're confusing me Fredriek, it's pandy that should be confused.
Thanks, that seems to do the trick. That's the problem with cutting and pasting, things get left out.
Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)