谁的脚本标签会影响页面呈现?

Hir*_*esh 1 html javascript jquery

我有这个代码:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <script type="text/javascript" href="http://code.jquery.com/jquery-1.5.min.js" />
        <title>JQuery Demo 1</title>
        <style type="text/css">
            #box
            {
                background-color: #ff0000;
            }
        </style>
        <script type="text/javascript">


        </script>
    </head>
    <body>
        <div id="box">----Text----!</div>
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

当我从Google中包含Jquery文件时,div"框"将停止为红色.当我删除JQuery文件时,它再次变为红色.为什么?

ale*_*lex 6

尽量不要script元素使用自我关闭语法,例如

<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.min.js"></script>
Run Code Online (Sandbox Code Playgroud)

...而且指向脚本文件的正确属性src不是href.

在jsFiddle上看到它.