【发布时间】:2014-03-05 03:49:39
【问题描述】:
我在 .html 文件中有以下代码,然后我用浏览器打开它。为什么我在页面加载时没有收到“Hello World”警报?我看到的只是“测试”文本。
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
$(document).ready(function() {
alert("Hello World!");
});
</script>
</head>
<body>
<p>
Test
</p>
</body>
</html>
【问题讨论】:
-
把你的函数放在一个额外的脚本标签中。
-
在这之间添加一个
<script type="text/javascript">:<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">和$(document) -
哈哈哈,我见过的最好的复制品!