JQuery学习笔记——如何使用JQuery
来源:互联网 发布:q币软件下载 编辑:程序博客网 时间:2024/05/16 14:27
引入JQuery <script src="jquery.js"></script>在官网http://jquery.com/可下载到最新版本,Production版本是压缩过的代码,文件小,但是不方便阅读。Development是开发版的代码,文件较大,可读性较好。
<script type="text/javascript">
$(document).ready(function(){
//code goes here
});
</script>
$的意思是jQuery = window.jQuery = window.$=$,因此JQuery(document)=$(document) document是网页中的对象,这里指代整个网页内容。
获取一个class的方法jQuery(".someClass").css("border", "1px solid red")
获取一个id的方法jQuery("#someId").html("<b>So Bold!</b>")
$(document).ready(function(){
//code goes here
});
相当于window.onload = function() 但是前者只要As soon as the DOM (Document Object Model) is ready, the code inside of the ready(function(){}) will start.
添加一个mouseover和mouseout事件:$('a.affLink').mouseover(function(){window.status=this.title;return true;})
.mouseout(function(){window.status='Done';return true;});
等同于
$('a.affLink').mouseover(function(){window.status=this.title;return true;});
$('a.affLink').mouseout(function(){window.status='Done';return true;});
<script src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('a.affLink').mouseover(function(){window.status=this.title;return true;})
.mouseout(function(){window.status='Done';return true;});
});
</script>
- JQuery学习笔记——如何使用JQuery
- jQuery学习笔记——初识jQuery
- jquery学习笔记—jQuery选择器
- JQuery学习—JQuery-Validation 使用
- jQuery学习笔记—选择器
- 《JQuery in Action》学习笔记——ch1 Introducing jQuery
- jQuery 学习笔记(三)——jQuery效果
- jQuery学习笔记1——初识jQuery
- 《锋利的jQuery》学习笔记——jquery中的事件
- 《锋利的jQuery》学习笔记——jquery动画
- jquery——学习笔记,简单认识jQuery
- 《jQuery基础教程》学习笔记(一)——jQuery事件
- jQuery学习笔记1——jQuery插件
- jQuery学习笔记二——jQuery选择器
- jQuery学习笔记2 —— jQuery选择器
- jQuery学习笔记——jQuery选择器练习
- JQuery学习笔记——JQuery常用选择器
- jquery学习笔记— jQuery对象和DOM对象
- 正在用C#制作贪食蛇 遇到了很多问题!
- 如何用jlink V8 升级 mini2440 bootloader
- 远程接入产品与企业即时通讯工具完美结
- 关于RTP时间戳及多媒体通信同步的问题
- 局域网通信软件 飞鸽传书
- JQuery学习笔记——如何使用JQuery
- 分布式集群即时通讯
- 编程世界里关于两个数值大小的有趣比较
- 我的事业,我的路——胡永盛教授
- 2010年最佳免费英文字体
- 网站开发人员应该知道的61件事
- 值得收藏的旭日阳刚的几首歌视频
- 一个人久了,会上瘾的...
- 优先队列