Closed Thread Icon

Preserved Topic: How to onLoad external JS? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=8764" title="Pages that link to Preserved Topic: How to onLoad external JS? (Page 1 of 1)" rel="nofollow" >Preserved Topic: How to onLoad external JS? <span class="small">(Page 1 of 1)</span>\

 
Hiroki
Paranoid (IV) Inmate

From: NZ
Insane since: Dec 2002

posted posted 07-21-2003 02:13

Hi, guys. How are you?
I just wonder if you could tell me how to onLoad external JS.
I have a file called external.js.
I want to use that file cuz it includes very important function for my site.
What I was doing is like:

code:
<body onLoad="../js/external.js">



But it has not worked yet.
Would you tell me something to knock off this problem?
Thanks.


Hiroki Kozai

Dracusis
Maniac (V) Inmate

From: Brisbane, Australia
Insane since: Apr 2001

posted posted 07-21-2003 04:26

You use onLoad to call functions or run javascript code, not to load a file.

If you want to include en extenal javascrip file use the <script> tag like so:

<script type="text/javascript" src="../js/external.js"></script>

Then that externally referenced file will be treated exactly the same as anything you'd type inbetween those <script></script> tags. But don't actually put anything between the script tags of an externall referenced js file as that will just cause all sorts of problems, if you need to use inline scripts as well, open a new script tag and put it in there.

Hiroki
Paranoid (IV) Inmate

From: NZ
Insane since: Dec 2002

posted posted 07-21-2003 05:38

Hi, Dracusis.
Many thanks for your reply.
Well, I am afraid I didn't make myself clear enough.
Sorry.
Actually this thread is related to this thread.
Mr. Max told me that :

quote:
Well, you also need to read previously stored cookie in onLoad body event in order to enable previously used style and disable others. As it is now, you're just storing a value as cookie and not doing anything with it later...



But I don't know how to handle that.
Would you know something about this???


Hiroki Kozai

« BackwardsOnwards »

Show Forum Drop Down Menu