$(function(){})和$(document).ready(function(){}) 的用法
当文档载入完毕就执行,以下几种效果是等价的:
1.
$(function(){ //这个就是jQuery ready()的简写,即下2的简写
// do something
});
2.
$(document).ready(function(){
//do something
})
3.
$().ready(function(){ //默认参数是:document
//do something
})
function one(){
alert("one");
}
function two(){
alert("two");
}
$(document).ready(function(){
one();
});
$(document).ready(function(){
two();
});
//运行代码后
//先是:one
//先是:two
function one(){
alert("one");
}
function two(){
alert("two");
}
window.onload=one;
window.onload=two;
//运行代码后只有 two
随机推荐
- IIS6的session丢失问题
解决办法: a IIS6中相比IIS5增加了一个应用程序池,默认是使用DefaultAppPool. b 先为站点建立一个应用程序池,打开IIS管理器,右键点击应用程序池-新建 ...
- Fractal Tree扩展
之前的博客实现了最基础的分形树,在这个基础上略微调整一些参数可以得到很多有趣的由分形树发展出的图案. private void drawShape(Graphics g, double x1, dou ...
- 深入分析:Fragment与Activity交互的几种方式(二,使用Bundle)
首先我们需要在Activity中动态添加Fragment时,用Bundle封装我们需要传递的数据. public void button(View view) { ArgFragment arg = ...
- BZOJ 2083 Intelligence test
用vector,二分. #include<iostream> #include<cstdio> #include<cstring> #include<algo ...
- css3 动画贝塞尔曲线
http://cubic-bezier.com/#.17,.67,.83,.67 缓动函数速查表: http://www.xuanfengge.com/easeing/easeing/ Ceaser: ...
- Divisors_组合数因子个数
Description Your task in this problem is to determine the number of divisors of Cnk. Just for fun -- ...
- [转]50 Shades of Go: Traps, Gotchas, and Common Mistakes for New Golang Devs
http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang/ 50 Shades of Go: Traps, Gotc ...
- Selenium Grid原理
转载: http://blog.csdn.net/five3/article/details/9428655 Selenium-Grid版本 selenium-grid分为版本1和版本2,其实它的2个 ...
- Smart210学习记录----beep linux字符设备驱动
今天搞定了beep linux字符设备驱动,心里还是很开心的,哈哈...但在完成的过程中却遇到了一个非常棘手的问题,花费了我大量的时间,,,, 还是把问题描述一下吧,好像这个问题很普遍的,网上许多解决 ...
- JQuery操作Table元素
使用Jquery操作Table中的tr向上或向下移动,以及全选和反选操作. 点击Table Head中的复选框,全选或反选表格中所有的复选框; 选中复选框,点击Up 按钮, tr上移;点击 Down ...