Hi,
J'ai un petit souci dans l'emploi de l'API Google Maps.
Je n'ai aucune erreur, la page se charge mais aucun Flag n'est affiché :
http://www.mercuzot.com/googlemap/carte.html
Voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Utilisation de XML</title> <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA3eQvTSY8_qbMR4pPuz3HrBS27SDEE4cB3Smap6s0jv7IbA-VihR8Kz9xX44f5c2MwidJ0JXpW8fmrg" type="text/javascript"></script> <script type="text/javascript"> function load() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map")); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng(45.55,6.10),9,G_HYBRID_MAP); function creerMarker(point, onglet1, onglet2) { var marker = new GMarker(point); var infoTabs = [ new GInfoWindowTab("Infos", onglet1), new GInfoWindowTab("Détails", onglet2) ]; GEvent.addListener(marker, "click", function() { marker.openInfoWindowTabsHtml(infoTabs); }); return marker; } var adress = null; GDownloadUrl("stations.xml", function(data) { var xml = GXml.parse(data); var markers = xml.documentElement.getElementsByTagName("marker"); for (var i = 0; i < markers.length; i++) { adress = markers[i].getAttribute("value"); geocoder = new GClientGeocoder(); geocoder.getLatLng(adress,function(point) { if (point) { var flagdot = new GMarker(point); map.addOverlay(flagdot); callback(flagdot); } else { callback (null); } } ); } }); } } </script> </head> <body onload="load()" onunload="GUnload()"> <div id="map" style="width: 1003px; height: 635px;"></div> </body> </html>
Partager