Referencing a js page, Unable to link to a script page |
Referencing a js page, Unable to link to a script page |
arcticwanderer |
Jun 22 2007, 11:04 AM
Post
#1
|
Newbie Group: Members Posts: 12 Joined: 22-June 07 Member No.: 3,151 |
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? |
Christian J |
Jun 22 2007, 04:07 PM
Post
#2
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
Could you provide a test page that shows the problem?
|
pandy |
Jun 22 2007, 04:42 PM
Post
#3
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
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?
|
Frederiek |
Jun 23 2007, 03:56 AM
Post
#4
|
Programming Fanatic Group: Members Posts: 5,146 Joined: 23-August 06 From: Europe Member No.: 9 |
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 WDG 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 script element 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. |
pandy |
Jun 23 2007, 04:46 AM
Post
#5
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
Christian tricked me. |
Frederiek |
Jun 23 2007, 04:48 AM
Post
#6
|
Programming Fanatic Group: Members Posts: 5,146 Joined: 23-August 06 From: Europe Member No.: 9 |
Must be a swedish thing then
|
Christian J |
Jun 23 2007, 04:58 AM
Post
#7
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
No, I meant a test page of the thing that didn't work. On the page above the script is still embedded. |
pandy |
Jun 23 2007, 05:18 AM
Post
#8
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
|
Frederiek |
Jun 23 2007, 06:00 AM
Post
#9
|
Programming Fanatic Group: Members Posts: 5,146 Joined: 23-August 06 From: Europe Member No.: 9 |
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 |
Christian J |
Jun 23 2007, 08:06 AM
Post
#10
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
Now you're confusing me Fredriek, it's pandy that should be confused.
As I suggested, the same thing can be done for the other scripts taken from elsewhere too. Agreed, but unless the OP shows an example of what didn't work we can't say what went wrong. The OP did post this example: CODE <script src="http://www.montagnaphotography.com/scripts.js" type=text/javascript></SCRIPT> which looks OK to me. |
pandy |
Jun 23 2007, 09:07 AM
Post
#11
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
|
arcticwanderer |
Jun 23 2007, 09:46 AM
Post
#12
|
Newbie Group: Members Posts: 12 Joined: 22-June 07 Member No.: 3,151 |
Could you provide a test page that shows the problem? Here is a test page www.montagnaphotography.com/baba. This will pull up the index to a folder I've called baba. As you can see the menu is gone. The scripts.js file is in the folder so it should work, but doesn't. You can look at that file by typing in : www.montagnaphotography.com/baba/scripts.js. The folder is a copy of the www.montagnaphotography.com/editorial page folder that has the js script still on the page and works fine. This tag : <script language=JavaScript1.2 src="coolmenus3.js"> works fine referencing the coolmenus3.js file so I don't understand why the other tag doesn't. Thanks alot. This post has been edited by arcticwanderer: Jun 23 2007, 09:52 AM |
Christian J |
Jun 23 2007, 12:13 PM
Post
#13
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
CODE <script language=JavaScript1.2 src="coolmenus3.js"> <script language=JavaScript src="scripts.js"> These two need a closing </script> tag each. |
arcticwanderer |
Jun 24 2007, 08:57 AM
Post
#14
|
Newbie Group: Members Posts: 12 Joined: 22-June 07 Member No.: 3,151 |
Thanks, that seems to do the trick. That's the problem with cutting and pasting, things get left out.
|
Lo-Fi Version | Time is now: 23rd April 2024 - 01:47 AM |