【发布时间】:2012-04-25 22:05:56
【问题描述】:
我在这个问题上停了 4 小时,if 在调用 Google 地图事件时忽略了我的布尔值。我需要提供参数不同的数据。也许世界上有人知道为什么?
console.log同时点击后抛出:
true before click
stack.html:56[object HTMLDivElement]in listener
stack.html:62[object HTMLDivElement]bunga bunga
破布尔:
this.b = true;
...
console.log(this.b + " beafore click");
this.mapListener = google.maps.event.addListener(map, 'click', function(e) {
console.log(this.b + "in listener");
if (this.b==true) {
console.log(this.b + "true works");
tools[type](e.latLng, last_marker_origin);
this.b = false;
} else {
console.log(this.b + "bunga bunga");
//tools[type](e.latLng);
}
});
this 指的是我的对象中的“属性”,默认设置为 false,但是当我将选项更改为 true。
我现在去睡觉。我会在早上回答。
【问题讨论】:
标签: javascript google-maps-api-3 error-handling boolean dom-events