欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

初步認(rèn)識(shí)JavaScript函數(shù)庫jQuery

 更新時(shí)間:2015年06月18日 10:16:39   投稿:goldensun  
這篇文章主要介紹了JavaScript函數(shù)庫jQuery的一些基本概念,包括其的添加方法和最基本的使用示例,需要的朋友可以參考下

jQuery 庫可以通過一行簡(jiǎn)單的標(biāo)記被添加到網(wǎng)頁中。
jQuery 庫 - 特性

jQuery 是一個(gè) JavaScript 函數(shù)庫。

jQuery 庫包含以下特性:

  •     HTML 元素選取
  •     HTML 元素操作
  •     CSS 操作
  •     HTML 事件函數(shù)
  •     JavaScript 特效和動(dòng)畫
  •     HTML DOM 遍歷和修改
  •     AJAX
  •     Utilities

向您的頁面添加 jQuery 庫

jQuery 庫位于一個(gè) JavaScript 文件中,其中包含了所有的 jQuery 函數(shù)。

可以通過下面的標(biāo)記把 jQuery 添加到網(wǎng)頁中:

<head>
<script type="text/javascript" src="jquery.js"></script>
</head>

請(qǐng)注意,<script> 標(biāo)簽應(yīng)該位于頁面的 <head> 部分。
基礎(chǔ) jQuery 實(shí)例

下面的例子演示了 jQuery 的 hide() 函數(shù),隱藏了 HTML 文檔中所有的 <p> 元素。
實(shí)例

<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
$("p").hide();
});
});
</script>
</head>

<body>
<h2>This is a heading</h2>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button type="button">Click me</button>
</body>
</html>

親自試一試
下載 jQuery

共有兩個(gè)版本的 jQuery 可供下載:一份是精簡(jiǎn)過的,另一份是未壓縮的(供調(diào)試或閱讀)。

這兩個(gè)版本都可從 jQuery.com 下載。
庫的替代

Google 和 Microsoft 對(duì) jQuery 的支持都很好。

如果您不愿意在自己的計(jì)算機(jī)上存放 jQuery 庫,那么可以從 Google 或 Microsoft 加載 CDN jQuery 核心文件。
使用 Google 的 CDN

<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs
/jquery/1.4.0/jquery.min.js"></script>
</head>

使用 Microsoft 的 CDN

<head>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery
/jquery-1.4.min.js"></script>
</head>


相關(guān)文章

最新評(píng)論