Does anyone know why <script src="scriptsource.js" /> doesn't work [duplicate]
Possible Duplicate:
Why don't self-closing script tags work?
I've no开发者_如何学Pythonticed that you can't slash-terminate a script tag when you specify a "src" and therefore don't require anything between the <script>
and the </script>
. This is the only tag I know of where you can't do that.
For example, this works:
<script type="text/javascript" src="scriptsource.js"></script>
and this doesn't
<script type="text/javascript" src="scriptsource.js" />
Because the script
requires an end tag:
Start tag: required, End tag: required
http://www.w3.org/TR/html4/interact/scripts.html
Here's your answer: Why don't self-closing script tags work?
Is it because you have to have a closing tag?
<script type="text/javascript" src="scriptsource.js"></script>
精彩评论