嗨,我有 3 个按钮,分别称为 1.ADD、2.EDIT、3.DELETE ......以及一个 id=comp_map 的地图......我正在使用 Open Street Maps......
function addComp() {
$("#comp_map").click(function() {
if (event.type !== 'mousemove') {
var containerPoint = comp_map.mouseEventToContainerPoint(event),
layerPoint = comp_map.containerPointToLayerPoint(containerPoint),
latlng = comp_map.layerPointToLatLng(layerPoint)
alert("Marker Location: "+latlng);
}
});
}
function editComp() {
// disable the map click
}
function delComp() {
// disable the map click
}
我的问题是我只想$("#comp_map").click
在单击添加按钮时工作...但是当单击其他按钮(例如编辑,删除)时,此功能不应该工作...这是正确的方法还是我的方法是错误的纠正我...谢谢...!