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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
| <html>
<head>
<title>Mon site, Géolocalisation</title>
<style type="text/css" >
html,body {
background-color : white;
margin: 0px 0px 0px 0px ;
}
div{
width : 100%;
height : 100%;
}
</style>
<script language='javascript'>
var nom=new Array();
var valeur=new Array();
// On enlève le ?
param = window.location.search.slice(1,window.location.search.length);
// On sépare le paramètres....
first = param.split("&");
for(i=0;i<first.length;i++){
second = first[i].split("=");
nom[i] = second[0];
valeur[i] = second[1];
valeur[i] = Remplace(valeur[i],"%20"," ");
}
function Remplace(expr,a,b) {
var i=0
while (i!=-1) {
i=expr.indexOf(a,i);
if (i>=0) {
expr=expr.substring(0,i)+b+expr.substring(i+a.length);
i+=b.length;
}
}
return expr
}
//load();
</script>
<script src="http://maps.google.com/maps?file=api&v=2.x&key=ABQIAAAAuod7-2b83lmkD7SNsBRvbBStzKCS3DTZyt5bP98UdB1NzGGnEBTF7CTG60tF4aY_5hDhoku3D01mAA" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var map = null;
var geocoder = null;
function load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
geocoder = new GClientGeocoder();
showAddress(valeur[0]);
}
}
function showAddress(address) {
if (geocoder) {
geocoder.getLatLng(address,function(point) {
if (!point) {
//alert(address + " not found");
} else {
map.setCenter(point, 15);
var marker = new GMarker(point);
map.addOverlay(marker);
}
});
}
}
// Read the data from example.xml
GDownloadUrl("example.xml", function(doc) {
var xmlDoc = GXml.parse(doc);
var markers = xmlDoc.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
// obtain the attribues of each marker
var addresslue = parseFloat(markers[i].getAttribute("plouf"));
// create the marker
ShowAddress(addresslue);
}
});
//]]>
</script>
</head>
<body onload="load()" onunload="GUnload()">
<div id="map"></div>
</body>
</html> |
Partager