我将一个函数(它本身有一个参数,比如说para)作为参数传递给另一个函数函数b()以及如何获取参数para。
这是一个简单的例子
<input type="button" onclick="sometest3()" value="Run test">
<script>
function sometest3() {
// pass an anonymous function as a parameter which has
// its own parameter "client"
sometest('connection',function(client){client.getInfo();})
}
function sometest(eve,func) {
// get this function's parameter which is "client" and pass
// a reference of sometest2 to it. so in the callback I can use
client.getInfo();
}
function sometest2() {
this.getInfo=function (){alert("get it");};
}
</script>