开发者

Does anyone know why <script src="scriptsource.js" /> doesn't work [duplicate]

This question already has answers here: Closed 11 years ago.

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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜