js中回调
来源:互联网 发布:financial market 知乎 编辑:程序博客网 时间:2024/06/01 08:24
转载自 http://blog.csdn.net/withiter/article/details/9234981
在JavaScript里什么叫Callback“回调函数”,用我的话来讲就是把方法b当做一个参数传递个方法a,当方法a执行完后执行另外一个指定函数(这里是b函数)
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title>callback function test</title> <script language="JavaScript" type="text/javascript"> function main(callback){ alert("i am main function"); alert("invoke callback function"); callback(); } function b(){ alert("i am callback function b"); } function c(){ alert("i am callback function c"); } function test(){ main(b); main(c); } </script> </head> <body> <button onclick="test()">点击</button> </body></html>
0 0
- js中回调
- js
- js
- JS
- JS
- JS
- js
- js
- js
- js
- js
- JS
- js
- JS
- js
- js
- js
- js
- VC提权
- copy,retain,strong的区别
- git 取消本地 commit (未push)
- 【Java】数组
- 488. Zuma Game(leetcode DFS hard)
- js中回调
- win7 64位 安装tensorflow GPU版本
- SpringMVC默认进入指定页的方法
- Oracle报错之INS-13001
- Cron表达式解释
- ABAP 简单的OLE操作
- nginx服务器http重定向到https的正确写法
- Java--String
- MySQL常用命令用法总结