Re: distributed <SCRIPT>s
by "Travis Wall" <wallt(at)cadvision.com>
|
Date: |
Wed, 26 Aug 1998 08:48:03 -0600 |
To: |
"HWG Theory" <hwg-theory(at)hwg.org> |
|
todo: View
Thread,
Original
|
|
>I sent this question to the language list, but did not get a single
>response. As I experienced the presence of some quite JS
>experienced people in this list with my last posting, I hope
>there will be somebody providing an answer to my JS
>question-of-the-day:
Fair enough young Jedi, if you can sense
our presense we might as well answer <g>
>Is there a significant difference between putting all my code
>(as far as possible) into one single <SCRIPT></SCRIPT>
>statement, compared to distributing function definitions and
>stuff over several such statements?
There's really no reason not to put everything
in between the script tags (except where it has
to be in the HTML itself). Unless you're site
is designed to support different browser
versions differently.
For example - NN2 supports JS1.0, NN3 - JS1.1
NN4 - JS1.2. so you could specify the language
for each of a series of script tags
<script language="Javascript 1.1">
...
</script>
<script language="Javascript 1.2">
...
</script>
Here the browser will initialise the script version
it was built for. Of course NN2 doesn't support
this (at least I couldn't get it to) which provided
all sorts of entertainment.
Now if you're thinking about putting your JS
functions all the way through your site (in the
midst of the body tags) I'd give some thought
to the level of readability your source will have
when it comes time to update it. If you want to
change one function you'll have to hunt around
to find it. Also JS integrated with the body tag
is loaded just like the HTML is (after the 'page'
is loaded) so you won't be able to do any of the
dynamic adjustments (no document.write stuff
which does anything). And it may run into other
problems.
Just out of curiosity, why would you want to
distribute you JS everywhere?
---
Travis Wall, Graphic Designer
Defiance Visual Industries
"design is the tribute art pays to industry"
--- (Paul Finch, Architect's Journal)
HWG hwg-theory mailing list archives,
maintained by Webmasters @ IWA