jQuery的環境搭建
搭建jQuery的運作環境
提供三個路徑下載:
1.jQuery 的線上引入 路徑。
http://code.jquery.com/jquery-3.1.1.min.js
上面的地址是總下載清單, 裡面有很多版本和類型的jQuery 庫, 主要分為以下幾類:
min: 壓縮後的jQuery 類別庫, 在正式環境上使用.如:jquery-3.1.1.min.js
vsdoc: 在Visual Studio 中需要引入此版本的jquery 類別庫才能啟用智慧感知.如:jquery-3.1.1-vsdoc2.js
release套件: 裡面有沒有壓縮的jquery 程式碼, 以及文件和範例程式. 如:jquery -3.1.1-release.zip
2.也可在jQuery 的官網中下載最新版本,下載地址:http://jquery.com/download/
##下載後是一個js 文件,我們只需要在html 文件中引入這個js 文件,便可。 3.在包含原始碼的github 位址中也有jQuery 的最新版本提供下載,位址為:https://github.com/shiyanlou/jQuery-base-code註:github 地址中包含的jquery-3.1.1js 版本是本次課程中使用到的文件,jquery-1.11.2.min.js 是發布課程時jQuery 的最新版本,且是壓縮版。
新建檔案
<!doctype html>
<html lang="zh">
<head>
<meta charset="utf-8"/>
<title>Hello World jQuery!</title>
<script src="http://code.jquery.com/jquery-3.1.1.min.js"></script>
</head>
<body>
<div id="divMsg">Hello jQuery!</div>
<input id="btnShow" type="button" value="show" />
<input id="btnHide" type="button" value="hidden" /><br/>
<input id="btnChange" type="button" value="change content is Hello World, too!"/>
<script>
$("#btnShow").bind("click", function(event) {
$("#divMsg").show();
});
$("#btnHide").bind("click", function(event) {
$("#divMsg").hide();
});
$("#btnChange").bind("click", function(event) {
$("#divMsg").html("Hello World, too!");
});
</script>
</body>
</html>
預覽
Clear
- 課程推薦
- 課件下載
課件暫不提供下載,工作人員正在整理中,後期請多關注該課程~ 















