Re: Why people use this style of javascript declaration?
- From: "VK" <schools_ring@xxxxxxxxx>
- Date: 11 Sep 2006 06:46:13 -0700
but since there is no content inside the tag anyway, what are the
reason behind this style?
If you want to question the reasons of those who
defined those rules then you might want to try your luck in
comp.infosystems.www.authoring.html.
I say this question more relevant to JavaScript rather then to the HTML
tags as such.
The reason is historical (as many things in HTML/scripting).
Until versions NN3/IE3 the only browser with JavaScript support was
Netscape 2.x, and it did not support external .js files, only scripts
directly inserted into page between <script>...</script> tags.
Respectively <script> tag was added to HTML specs as the one requiring
closing tag.
With versions NN3/IE3 it became possible to use external .js files, but
the paired tag was used as the fall-back option for NN2 users. If both
src attribute and inline content were provided, NN3/IE3 users would get
the external .js file executed and inline content ignored. NN2 users
would get src ignored and inline block executed:
<script language="JavaScript" src="external.js">
window.alert("Your browser doesn't support external scripts");
</script>
(btw it is another FAQ when people are trying to combine both external
and inline scripts in one tag and getting only the external script
executed. If you ever tried it and wondered why then here is the
answer).
By NN4/IE4 the above became a standard with a bunch of legacy scripts
around, so it was too late to change anything.
Hope it helps.
.
- Follow-Ups:
- Re: Why people use this style of javascript declaration?
- From: Randy Webb
- Re: Why people use this style of javascript declaration?
- References:
- Why people use this style of javascript declaration?
- From: howachen
- Re: Why people use this style of javascript declaration?
- From: Martin Honnen
- Re: Why people use this style of javascript declaration?
- From: howachen
- Re: Why people use this style of javascript declaration?
- From: Martin Honnen
- Why people use this style of javascript declaration?
- Prev by Date: Re: undefined vs. undefined (was: new Array() vs [])
- Next by Date: Re: undefined vs. undefined (was: new Array() vs [])
- Previous by thread: Re: Why people use this style of javascript declaration?
- Next by thread: Re: Why people use this style of javascript declaration?
- Index(es):
Relevant Pages
|
|