Js 自定义回调函数

参考 http://mlxnle.iteye.com/blog/1670679

<!doctype html>
<html lang="es">
<head>
	<meta charset="UTF-8">
	<title>HTML5</title>
	<link rel="stylesheet" href="#" /><!-- css样式  -->
	<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
</head>
<script type="text/javascript">
$(document).ready(function(){
	/** 
	 * 回调函数测试方法 
	 *  
	 * @param callback 
	 *            被回调的方法 
	 */  
	function testCallback(callback) {  
		alert('come in!');  
		callback();  
	}  
	  
	/** 
	 * 开始测试方法
	 */  
	testCallback(function(){  
		alert('a'); 
		$("#div1").fadeIn();
		$("#div2").fadeIn("slow");
		$("#div3").fadeIn(3000);
	});   
});   
</script>
<body>
	<div class="test"></div>
	<div id="div1" style="width:80px;height:80px;display:none;background-color:red;"></div><br>
	<div id="div2" style="width:80px;height:80px;display:none;background-color:green;"></div><br>
	<div id="div3" style="width:80px;height:80px;display:none;background-color:blue;"></div>
</body>
</html>

  

posted @ 2014-12-25 13:21  流转的岁月  阅读(1389)  评论(0编辑  收藏  举报