The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> Referencing a js page, Unable to link to a script page
arcticwanderer
post 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?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies(1 - 13)
Christian J
post Jun 22 2007, 04:07 PM
Post #2


.
********

Group: WDG Moderators
Posts: 6,168
Joined: 10-August 06
Member No.: 7



Could you provide a test page that shows the problem?


--------------------
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jun 22 2007, 04:42 PM
Post #3


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 15,570
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?


--------------------
"Never go to excess, but let moderation be your guide."
- Cicero

IPB Image
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Frederiek
post Jun 23 2007, 03:56 AM
Post #4


Programming Fanatic
********

Group: Members
Posts: 4,455
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.


--------------------
"The earth does not belong to us. We belong to the earth."
from Vue du ciel (in French)

"Leave scepticism to others and take action"
from HOME by Goodplanet

An inconvenient truth by Al Gore
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jun 23 2007, 04:46 AM
Post #5


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 15,570
Joined: 9-August 06
Member No.: 6



QUOTE(Frederiek @ Jun 23 2007, 10:56 AM) *

An url was already provided: http://www.montagnaphotography.com

Christian tricked me. blush.gif


--------------------
"Never go to excess, but let moderation be your guide."
- Cicero

IPB Image
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Frederiek
post Jun 23 2007, 04:48 AM
Post #6


Programming Fanatic
********

Group: Members
Posts: 4,455
Joined: 23-August 06
From: Europe
Member No.: 9



Must be a swedish thing then biggrin.gif


--------------------
"The earth does not belong to us. We belong to the earth."
from Vue du ciel (in French)

"Leave scepticism to others and take action"
from HOME by Goodplanet

An inconvenient truth by Al Gore
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jun 23 2007, 04:58 AM
Post #7


.
********

Group: WDG Moderators
Posts: 6,168
Joined: 10-August 06
Member No.: 7



QUOTE(Frederiek @ Jun 23 2007, 10:56 AM) *

An url was already provided: http://www.montagnaphotography.com

No, I meant a test page of the thing that didn't work. On the page above the script is still embedded.


--------------------
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jun 23 2007, 05:18 AM
Post #8


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 15,570
Joined: 9-August 06
Member No.: 6



That wasn't clear. rolleyes.gif

QUOTE(Frederiek @ Jun 23 2007, 11:48 AM) *

Must be a swedish thing then biggrin.gif

I'm so gullible! blush.gif


--------------------
"Never go to excess, but let moderation be your guide."
- Cicero

IPB Image
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Frederiek
post Jun 23 2007, 06:00 AM
Post #9


Programming Fanatic
********

Group: Members
Posts: 4,455
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 wink.gif


--------------------
"The earth does not belong to us. We belong to the earth."
from Vue du ciel (in French)

"Leave scepticism to others and take action"
from HOME by Goodplanet

An inconvenient truth by Al Gore
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jun 23 2007, 08:06 AM
Post #10


.
********

Group: WDG Moderators
Posts: 6,168
Joined: 10-August 06
Member No.: 7



Now you're confusing me Fredriek, it's pandy that should be confused. tongue.gif

QUOTE(Frederiek @ Jun 23 2007, 01:00 PM) *

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.


--------------------
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jun 23 2007, 09:07 AM
Post #11


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 15,570
Joined: 9-August 06
Member No.: 6



QUOTE(Christian J @ Jun 23 2007, 03:06 PM) *

Now you're confusing me Fredriek, it's pandy that should be confused. tongue.gif

Sometimes your mission fails. IPB Image


--------------------
"Never go to excess, but let moderation be your guide."
- Cicero

IPB Image
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
arcticwanderer
post Jun 23 2007, 09:46 AM
Post #12


Newbie
*

Group: Members
Posts: 12
Joined: 22-June 07
Member No.: 3,151



QUOTE(Christian J @ Jun 22 2007, 04:07 PM) *

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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jun 23 2007, 12:13 PM
Post #13


.
********

Group: WDG Moderators
Posts: 6,168
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.


--------------------
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
arcticwanderer
post 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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 30th October 2014 - 01:10 PM