Javascript callback and function pointer
簡單的代碼示例:<!--
function show(cbfunction,name){
return function(sex){//這里返回一個有參數的Function
cbfunction(name);//調用參數傳入的函數
alert(sex);
}
}
function hello(name){
alert("hello " + name);
}
var fn = show(hello,"aichen");//返回的是一個函數,fn 為函數指針
fn("boy");
--//>
have fun!^_^
posted on 2006-03-24 13:41 艾塵 閱讀(783) 評論(0) 編輯 收藏 所屬分類: learn more