gpt4 book ai didi

javascript - jQuery 导致页面从根本上失败......为什么?

转载 作者:行者123 更新时间:2023-11-28 14:01:29 25 4
gpt4 key购买 nike

只要我定义了对 jQuery 的引用,我就有一个函数不被视为在范围内。如果我评论说引用该函数的调用有效。我有其他页面以相同的方式引用 jQuery 并且它们可以工作。真的很令人沮丧。给出了什么?

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

最佳答案

doctype HTML 支持结束脚本作为短标签吗?我会尝试<script src...></script> .

关于javascript - jQuery 导致页面从根本上失败......为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4882397/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com