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

 

网页特效大全 jQuery等:http://ini.iteye.com/blog/2165698

你可能感兴趣的:(JavaScript,html,jquery,Web,css)