RE: Java Scripts
by Rebecca Campbell <rcampbel(at)standard.com>
|
| Date: |
Mon, 10 Jan 2000 10:27:15 -0800 |
| To: |
"'SDJThorin'" <sdjthorin(at)geocities.com>, hwg-techniques(at)hwg.org |
| |
todo: View
Thread,
Original
|
|
i have a guess as to why "/scripts/yourscript.js" doesn't always work, but
i'm a little shaky on why "../scripts/yourscript.js" does.
there are three basic ways to link to something from a web page, afaik.
1) a relative link that is based on the location of the file:
href="page2.html" will work for any web page that resides in that same
folder.
2) an absolute link for the server your html file is on:
href="https://hwg.org/mysite/page2.html". this says go to the root of the site (i.e., put
in 'http://www.nerdygirl.com') and then find the folder 'mysite' and then
find the file 'page2.html'.
3) a completely absolute link:
href="http://www.nerdygirl.com/mysite/page2.html". this should be fairly
self-explanatory.
so, when you start your src="https://hwg.org/scripts..." i'm wondering if perhaps your
script folder isn't at the root of the site on the server, so it's not able
to find the folder /scripts. does it work if you remove the beginning '/' ?
i've had difficulties with referencing background url's in css and found
that putting ../ in front helps, but i haven't so far had any trouble with
linking to my .js files...
hth (and that i'm not totally off base!),
-rebecca
http://www.nerdygirl.com
-----Original Message-----
From: SDJThorin [mailto:sdjthorin(at)geocities.com]
Sent: Monday, January 10, 2000 6:00 AM
To: The Lion's Cub
Cc: hwg-techniques(at)hwg.org
Subject: Re: Java Scripts
It's as simple as this :
<SCRIPT SRC="../Scripts/yourscript.js" LANGUAGE="JavaScript">
Mind you, what I do is place all my sites content into various
directories one of which is "Scripts", so that this Tag will work
anywhere on my site except for the home page in the root, where
I remove the "../". Therefore this will only work if you do something
similar.
I've also tried using :
<SCRIPT SRC="https://hwg.org/Scripts/yourscript.js" LANGUAGE="JavaScript">
But it doesn't always seem to work correctly, so I use the first
method.
*** Does anyone know why this shouldn't always work? ***
Happy Coding,
Stephen.
The Lion's Cub wrote:
>
> Ok on to my question. I use two of the same scripts on several of my
pages.
> I want to make sure the scripts are identical and I want to protect them
in
> case I may accedentally alter one while editing other parts of the page.
So
> I thought it would be rather simple do declare them as external with the
src
> element. However i cannot get IE (I have not checked with Netscape yet)
to
> write the script. Is there a specific file extension I need to be using.
I
> am using reletive url, to make it easier to work locally then send it to
the
> server without changes.
>
> I tried looking at some java sites but they seem to only deal with inline
> scripts.
----------------------------------------------------------------
| /~\ ^| |^ /~\ The WyldeSide |
| / /\ (o) (o) /\ \ Web Designs & Programming, |
| | | | ( o~o ) | | | For Your Needs |
| \ \ \ ) O ( / / / http://www.wyldeside.com |
----------------------------------------------------------------
HWG hwg-techniques mailing list archives,
maintained by Webmasters @ IWA
This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.