Re: Java Scripts

by 2Nerotik <2nerotik(at)nisa.net>

 Date:  Mon, 10 Jan 2000 15:46:48 -0800
 To:  hwg-techniques(at)hwg.org
 References:  nisa geocities lionscub
  todo: View Thread, Original
Ok maybe I should have been clearer... using just a slash is NOT reliable.
Most of the time IT WILL NOT WORK.

Either use a ./ (dot slash) or no slash at all. ie if your JS file resides
in a lower folder than the page calling it use ./ or no slash at all. If the
HTML page resides in a folder AND the JS resides in a folder BUT the folders
are on the same level... ie /root/html_page & /root/JS_file then ../ is 
required
to fetch the JS.

NOTE: this rule also applies to the IMG tag AND linking a CSS file as well.

SO:
<LINK SRC="main.css"> AND <LINK SRC="./main.css">
<SCRIPT SRC="main.js"> AND <SCRIPT SRC="./main.js">
<IMG SRC="main.css"> AND <IMG SRC="./main.js">

are the same but the following while looking the same as the
above do not work. I know I've made that mistake, and if they
did work then same as the above we wouldn't be having this discussion
in the first place.

<LINK SRC="/main.css">
<SCRIPT SRC="/main.js">
<IMG SRC="/main.js">

Please note the above tags are not complete as only the source designation was
needed for this demo.

At 10:17 am 11/01/2000 +1300, Kyle Matthews wrote:
>At 11:39 AM 1/10/00 -0800, you wrote:
> >At 08:59 am 10/01/2000 -0500, SDJThorin wrote:
> >>         <SCRIPT SRC="/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? ***
> >Because you need a ./ (dot slash) not just a / to target a folder from the
> >root.
> >And sticking all you scripts in one Script folder is a good idea. Easier to
> >keep track
> >of them.
>
>actually, the likely structure for a user account on a unix box is:
>
>/home/username/public_html/scripts/yourscript.js
>
>using "/...." isn't a reference to "public_html/", it's most likely a
>reference to the actual root directory of the server, or the root directory
>of your account ("/home/username/").
>
>try "/public_html/scripts/yourscript.js", or
>"/home/username/public_html/scripts/yourscript.js", depending on the exact
>way your server is set up, and the structure of the useraccounts.
>
>Kyle

.oOo.
|| Never say 'Opps !' always say 'Ah, interesting !'
||
||  Addicted 2 Swing ---> http://www.nisa.net/~2nerotik/
||  Fontaholic ? ---> http://www.fontsanon.com
||  HTML Writers Guild ---> http://www.hwg.org

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA