怎么使用jQuery


jQuery的強大何文啟(個人主頁:hovertree.com)就不用多說了,那么怎么使用jQuery呢?


首先,下載jquery。下載地址:http://hovertree.com/hvtart/bjae/b8627323101a4994.htm,一個是壓縮版本,一個是未壓縮版本,如果在開發測試階段,可以使用未壓縮版本,實際應用一般使用壓縮版本(min)。

然后就在頁面上引用。代碼如下:

<head>
<script type="text/javascript" src="http://hovertree.com/ziyuan/jquery/jquery-1.11.3.min.js"></script>
</head>

那么,接下來你就可以使用jQuery的強大功能了。例如設置頁面上的鏈接為紅色。

代碼如下:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery改變鏈接的顏色-何問起</title><base target="_blank" />
<script type="text/javascript" src="http://hovertree.com/ziyuan/jquery/jquery-1.11.3.min.js"></script>
</head>
<body>
<a href="http://hovertree.com">首頁</a> <a href="http://hovertree.com/texiao/">更多特效</a> <a href="http://hovertree.com/hvtart/bjae/594821fc653c4fb4.htm">原文</a> <a href="http://hovertree.com/hvtart/bjae/b6fd7e9e75b8773b.htm">參考</a>

<br />
注意本頁上鏈接的顏色
<script>
$(document).ready(function () { $("a").css("color", "red"); });
</script>
</body>
</html>

可以點擊這里查看效果:http://hovertree.com/texiao/jquery/3.htm

本效果使用到jQuery的css方法,參考:http://hovertree.com/hvtart/bjae/b6fd7e9e75b8773b.htm

轉自:http://hovertree.com/hvtart/bjae/594821fc653c4fb4.htm

Web前端資源匯總 http://www.cnblogs.com/jihua/p/webfront.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM