Kun*_* S. -1 javascript jquery
helloWorld()执行dragTrack()功能后需要运行.但是helloWorld之后没有被召唤dragTrack.
dragTrack(function(){
helloWorld();
});
function dragTrack() {
alert('first');
}
function helloWorld() {
alert('second');
}
Run Code Online (Sandbox Code Playgroud)
您将函数作为参数传递,但dragTrack需要更改为接受回调并调用它
dragTrack(helloWorld);
function dragTrack(callback) {
alert('first');
if (callback) {
callback();
}
}
function helloWorld() {
alert('second');
}Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
90 次 |
| 最近记录: |