引入jQuery

用于测试和开发(未压缩,是可读的代码)

用于实际的网站中,已被精简和压缩。
 
jQuery 1.x
jQuery Migrate  过渡版
jQuery 2.x
 
远程:
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
 
or
 
本地:
<script type="text/javascript" src="js/jquery-1.11.2.min.js"></script>
 
关于相对路径:
C:Documents and SettingsAdministrator桌面随便写写.html
C:Documents and SettingsAdministrator桌面jsjquery-1.11.2.min.js
C:Documents and SettingsAdministrator桌面1jquery-1.11.2.min.js
 
在随便写写.html中如何引入改jQuery?
 
src="js/jquery-1.11.2.min.js"
file:///C:/Documents and Settings/Administrator/桌面/js/jquery-1.11.2.min.js
 
src="./js/jquery-1.11.2.min.js"
file:///C:/Documents and Settings/Administrator/桌面/js/jquery-1.11.2.min.js
 
src="../桌面1/jquery-1.11.2.min.js"
file:///C:/Documents and Settings/Administrator/桌面1/jquery-1.11.2.min.js
 
src="../js/jquery-1.11.2.min.js"
file:///C:/Documents and Settings/Administrator/js/jquery-1.11.2.min.js
 
src="./../js/jquery-1.11.2.min.js"
file:///C:/Documents and Settings/Administrator/js/jquery-1.11.2.min.js
 
src="/js/jquery-1.11.2.min.js"
file:///C:/js/jquery-1.11.2.min.js
 
src="../../../js/jquery-1.11.2min.js"
file:///C:js/jquery-1.11.2.min.js
 
src="../jquery-1.11.2.min.js"
file:///C:/Documents and Settings/Administrator/jquery-1.11.2.min.js
 
对错显而易见。
 
结论:
. 代表当前目录
..代表父目录
/代表根目录
多个组合时从右往左运算
唯一变量是这些函数所在文件的所在位置,即本例中html文件位置。
 
注:
结果由Chrome 浏览器 查看网页源码得出。
原文地址:https://www.cnblogs.com/zno2/p/4495174.html