每次用Google的
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(num);
});
就觉得很爽,传个函数过去,onclick事件就能触发,以前自己也想写类似的功能,几次都没搞出来,今天随手写两行代码反而搞定了.
示例如下
function test1(a, b) {
b();
}
function test2() {
var ttt = 'hello';
test1(1, function() { alert(ttt); })
}
运行test2(),弹出警告"hello"