我正在尝试在 Bing 地图上单击鼠标右键。我得到的只是浏览器上下文菜单(我想禁用它)。如何修改以下代码以使鼠标右键单击起作用?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>
<script type="text/javascript">
var map = null;
function GetMap() {
// Initialize the map
map = new Microsoft.Maps.Map(document.getElementById("myMap"),
{ credentials: "MyApiKey" });
//Add handler for the map click event.
Microsoft.Maps.Events.addHandler(map, 'click', function (e) {
alert('click');
if (e.isSecondary)
alert('rightclick');
});
}
</script>
</head>
<body onload="GetMap();">
<div id='myMap'>
</div>
</body>
</html>