1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| <html>
<head>
<title>test bing maps</title>
<script charset="UTF-8" type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&mkt=fr-fr"></script>
<script type="text/javascript">
var map = null;
var myCredential = "xxxxxxxxxxxxxx";
var mapOptions = {
credentials: myCredential,
mapTypeId: Microsoft.Maps.MapTypeId.road,
center: new Microsoft.Maps.Location(43.62807, 0.87578),
zoom: 10
}
function GetMap() {
// Initialize the map
map = new Microsoft.Maps.Map(document.getElementById("mapDiv"), mapOptions);
////////////////////////////////////////////////////////////////////////////
// AD A PIN ON THE MAP
// Retrieve the location of the map center
var PosCarte = map.getCenter();
var PosMyPin = new Microsoft.Maps.Location(43.62807, 0.87578);
// Add a pin to the center of the map
var pinOptions = {
//text: '.',
icon: 'http://www.mywebsite/images/MyPin.png',
width: 40, //50
height: 43, //57
draggable: false
}
var pin = new Microsoft.Maps.Pushpin(PosMyPin, pinOptions);
map.entities.push(pin);
////////////////////////////////////////////////////////////////////////////
//ADD AN INFOBOX
// Create the infobox for the pushpin
pinInfobox = new Microsoft.Maps.Infobox(pin.getLocation(),
{
title: 'Mon PushPin',
description: 'Exemple de texte dans mon infobox.',
visible: false,
offset: new Microsoft.Maps.Point(0, 15)
});
Microsoft.Maps.Events.addHandler(pin, 'click', displayInfobox);
Microsoft.Maps.Events.addHandler(map, 'viewchange', hideInfobox);
map.entities.push(pinInfobox);
////////////////////////////////////////////////////////////////////////////
}
function displayInfobox(e) {
pinInfobox.setOptions({ visible: true });
}
function hideInfobox(e) {
pinInfobox.setOptions({ visible: false });
}
</script>
</head>
<body onload="GetMap();">
<form id="form1" name="form1" action="" method="get" enctype="application/x-www-form-urlencoded">
<input type="button" value="Calculate Route" onclick="ClickRoute()" />
</form>
</body>
</html> |
Partager