开发者

jQuery causing page to fail at a fundamental level... Why?

I have a function that is not seen as being in scope as long as I have a reference to jQuery is defined. If I comment that reference the call to the function works. I have other pages that reference jQuery the same way and they work. Its really frustrating. What gives?

<!DOCTYPE HTML>
<html>
<head>
<title>Anything</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" />
<script type="text/javascript">
    function test() {
        alert('开发者_开发问答This works')
    }
</script>
</head>
<body>
text
<script type="text/javascript">
    test();
</script>
</body>
</html>


Does doctype HTML support closing script as a short tag? I would try <script src...></script>.


Instead of doing...

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" />

... do this:-

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>

script tag is weird. :)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜