我正在尝试将右键单击事件添加到谷歌地图。我的代码出现以下错误:Microsoft JScript 运行时错误:无法获取属性“_ e3 ”的值:对象为空或未定义。我不确定要改变什么。
var map;
var directionsDisplay;
var directionsService = new google.maps.DirectionsService();
function initialize() {
directionsDisplay = new google.maps.DirectionsRenderer();
var mapOptions = {
zoom: 8,
center: new google.maps.LatLng(-34.397, 150.644),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('mapsGoogle'),
mapOptions);
directionsDisplay.setMap(map);
directionsDisplay.setPanel(document.getElementById('directions-panel'));
HomeTestMarker();
}
google.maps.event.addListener(map, 'rightclick', function(event ) {
var lat = event.latLng.lat();
var lng = event.latLng.lng();
alert("Lat=" + lat + "; Lng=" + lng);
});