亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

jQuery的簡(jiǎn)單使用

在網(wǎng)頁(yè)中加入 jQuery

#可以透過(guò)多種方法在網(wǎng)頁(yè)中加入 jQuery。 您可以使用以下方法:

  • 從jquery.com 下載jQuery 庫(kù)

  • 從CDN 載入jQuery, 如從Google 載入jQuery


#下載jQuery

有兩個(gè)版本的jQuery 可供下載:

  • #Production version - 用於實(shí)際的網(wǎng)站中,已精簡(jiǎn)和壓縮。

  • Development version - 用於測(cè)試和開發(fā)(未壓縮,是可讀的程式碼)

以上兩個(gè)版本都可以從jquery .com 中下載。

jQuery 函式庫(kù)是一個(gè)JavaScript 文件,您可以使用HTML 的<script> 標(biāo)籤來(lái)引用它:

<head>
<script src="jquery-1.10.2 .min.js"></script>
</head>

#: 將下載的檔案放在網(wǎng)頁(yè)的相同目錄下,就可以使用jQuery。



##如果您不希望下載並存放jQuery,那麼也可以透過(guò)CDN(內(nèi)容分發(fā)網(wǎng)路) 引用它。

百度、又拍雲(yún)端、新浪、Google和微軟的伺服器都存有 jQuery 。

如果你的網(wǎng)站使用者是國(guó)內(nèi)的,建議使用百度、又拍雲(yún)、新浪等國(guó)內(nèi)CDN地址,如果你網(wǎng)站使用者是國(guó)外的可以使用Google和微軟。

附註:本站實(shí)例皆採(cǎi)用百度 jQuery CDN函式庫(kù)。

<head>
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
< ;/script>
</head>

實(shí)例:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php.cn</title>
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
</script>
 <script>
 $(document).ready(function(){
 $("#hide").click(function(){
 $("p").hide();
 });
 $("#show").click(function(){
 $("p").show();
 });
 });
 </script>
</head>
<body>
 <p>歡迎大家來(lái)到php.cn</p>
 <button id="hide">隱藏</button>
 <button id="show">顯示</button>
</body>
</html>
繼續(xù)學(xué)習(xí)
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php.cn</title> <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("#hide").click(function(){ $("p").hide(); }); $("#show").click(function(){ $("p").show(); }); }); </script> </head> <body> <p>歡迎大家來(lái)到php.cn</p> <button id="hide">隱藏</button> <button id="show">顯示</button> </body> </html>
提交重置程式碼