我是一个
jquery首发,所以如果它是一个错误的人原谅我:)
我只是想知道为什么将内容放在不同的位置使这个脚本工作,尽管我认为最好的脚本保留在文档的主题部分.请解释一下这个概念.
工作守则
<!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>