【发布时间】:2012-09-08 07:44:17
【问题描述】:
我是 jquery 入门者,如果写错了请见谅:)
我只是想知道为什么将内容放在不同的位置会使这个脚本工作,尽管我认为脚本保存在文档的head 部分。请解释一下这个概念。
工作代码
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Example 2</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<p>
</p>
<script type="text/javascript">
jQuery("p").html("Check if jQuery Supports Ajax method : "+ jQuery.support.ajax );
</script>
</body>
</html>
不工作
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Example 2</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
jQuery("p").html("Check if jQuery Supports Ajax method : "+ jQuery.support.ajax );
</script>
</head>
<body>
<p>
</p>
</body>
</html>
【问题讨论】:
-
@YouQi thx for the link ..jquery 似乎非常庞大:)
标签: javascript jquery html logic concept