je ne suis pas expert en java script ni en google map
et je galère un peu avec le script qui suit....
le but est de placer un "marker" en passant au dessus d'un premier lien web, puis de déplacer ce marker sur la carte en passant au dessus d'un autre lien...
j'ai résolu provisoirement mon problème en detruisant les "markers" qui apparaissent après une delai de 5 secondes.
j'ai aussi testé un on mouseover avec un removeMarker. je n'ai pas compris pourquoi le remove marker ne fonctionne pas.
en attendant je sèche lamentablement
Merci pour une petite aide...
marc Delepière
et je galère un peu avec le script qui suit....
le but est de placer un "marker" en passant au dessus d'un premier lien web, puis de déplacer ce marker sur la carte en passant au dessus d'un autre lien...
j'ai résolu provisoirement mon problème en detruisant les "markers" qui apparaissent après une delai de 5 secondes.
j'ai aussi testé un on mouseover avec un removeMarker. je n'ai pas compris pourquoi le remove marker ne fonctionne pas.
Il me manque probablement 3 virgule de code pour que ça marche<!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" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>GeoLoc 2</title>
<script src="http://maps.google.com/maps?file=api&v=2.x&key=ABQIAAAAb3shBnsOX_hLgYAXaD3_RxSbyYI2FynueqXjGT8-bVC_7UdwWxTZxd-peKRyoiOTNOO3SYAxz6XM9A" type="text/javascript"></script>
<script type="text/javascript">
var map = null;
var marker=null;
var geocoder = null;
var zoom = 10;
function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(48.9, 2.3), 10);
map.addControl(new GLargeMapControl());
geocoder = new GClientGeocoder();
showAddress('Schiltigheim, France');
}
}
function placeMarker(point){
map.setCenter(point);
var marker = new GMarker(point); map.addOverlay(marker);
window.setTimeout(function() { map.removeOverlay(marker) }, 5000);
}
function movMarker(){};
function removeMarker(){ map.removeOverlay(marker) }
function showAddress(address){
if (geocoder) {
geocoder.getLatLng (
address,
function(point) {
if (!point) { alert(address + " not found"); } else { placeMarker(point); }
} ) } }
</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<div id="map_canvas" style="width: 500px; height: 300px"></div>
<script language="javascript">
showAddress('93 rue d\'Alsace, Schiltigheim, France');
</script>
<a href="" onmouseover="showAddress('Schiltigheim, France'); ">Schiltigheim</a> -
<a href="" onmouseover="showAddress('eschau, France');">Eschau </a> -
<a href="" onmouseover="showAddress('oberhausbergen, France');">Oberhausbergen</a> -
<a href="" onmouseover="removeMarker(marker);">remove marker</a> -
<br />
</body>
</html>
en attendant je sèche lamentablement
Merci pour une petite aide...
marc Delepière