API google avec IE6

Bonjour,

j'utilise l'api google map javascript v2, j'ai une carte avec des marqueurs et des fonctionnalités simples (zoom sur commune et centrage de la carte à partir dun champ texte). Tout fonctionne bien sur Firefox, et rien sur Internet explorer, notamment le 6...

qqun at-il l'habitude de dégugger du Javascript pour IE6 ? L'api V2 est sensée etre compatible...

je livre mon code a vos yeux d'experts..

 


  <head> 
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    <title>ICI</title> 
    
<script src="jquery142.js" type="text/javascript"></script> 

  <script type="text/javascript"> 

  
   
   
  /* LES ICONES DEBUT */ 
   
   var myIcons = []; 
   
   
  var points_verts = new GIcon(G_DEFAULT_ICON, "images/points_verts3.png"); 
  points_verts.iconSize = new GSize(20,30); 
  points_verts.shadow = ""; 
  points_verts.iconAnchor = new GPoint(10,30); 
  myIcons["points_verts"] = points_verts; 
   
  /* LES ICONES FIN */ 
   
   
  

 function createMarker(point, type, contenu) { 

          markerOptions = { icon:myIcons[type] }; 
          var marker = new GMarker(point, markerOptions); 

          GEvent.addListener(marker, "click", function() { 
            marker.openInfoWindowHtml(contenu); 
          }); 
          return marker; 
        } 
  

  
  
  
  
  
  

  </script> 
   
  <!-- Make the document body take up the full screen --> 

  


  </head> 

  <body> 
  <!-- Declare the div, make it take up the full document body --> 
   
  
    <div id="map_canvas" style="width: 100%; height: 100%; position:absolute; z-index:0; min-width:955px; min-height:580px;"></div> 
  
 <div id="legende_box"> 

    
   <h2 class="filtre">Centrer la carte</h2> 
   <div style="float:left;">  
     
    <p class="pointsverts">Commune et Code postal :</p> 
     
        <form action="#" onsubmit="showAddress(this.address.value); return false"> 
     <input type="text" size="25" name="address" style="margin-left:15px; border:1px solid #000;"><br> 
     <input class="cancel_filters" type="submit" value="Centrer la carte" style="margin-left:15px; margin-top:3px;"> 
     <input type="button" value="Imprimer" class="cancel_filters" style="margin-left:0px;" onClick="window.print()"> 
     <br><a href="index.php"><input type="button" class="cancel_filters" value="Annuler"></a> 

     </form> 


     
   </div> 

  

  </div>  
     
   <div id="global"> </div> 
    <script type="text/javascript"> 
    //<![CDATA[   

   

  var map; 
   
  function MakeMap(){ 
   
    if (GBrowserIsCompatible()) { 
      map = new GMap2(document.getElementById("map_canvas"),{mapTypes: [G_HYBRID_MAP, G_NORMAL_MAP, G_PHYSICAL_MAP], backgroundColor: "#CCCCCC"}); 
        var salleTicket = new GLatLng(45.187406,5.713127); 
  geocoder = new GClientGeocoder(); 
  map.setCenter(salleTicket, 11); 
  map.addControl(new GSmallZoomControl3D()); 
  map.addControl(new GMapTypeControl()); 
  map.setZoom(9); 
   
   
   
   
  /* LIMITE DES ZOOM DEBUT */ 
   
  var minMapScale = 9; 
  var maxMapScale = 14; 
// get array of map types 
  var mapTypes = map.getMapTypes(); 
// overwrite the getMinimumResolution() and getMaximumResolution() methods for each map type 
  for (var i=0; i<mapTypes.length; i++) { 
  mapTypes[i].getMinimumResolution = function() {return minMapScale;} 
  mapTypes[i].getMaximumResolution = function() {return maxMapScale;} 
  } 

  <!-- LIMITE DES ZOOM FIN --> 
   
        // The allowed region which the whole map must be within 
      var allowedBounds = new GLatLngBounds(new GLatLng(43.9360278,3.7093856), new GLatLng(46.2057645, 6.141593)); 
       
    
      // If the map position is out of range, move it back 
      function checkBounds() { 
        // Perform the check and return if OK 
        if (allowedBounds.contains(map.getCenter())) { 
          return; 
        } 
        // It's not OK, so find the nearest allowed point and move there 
        var C = map.getCenter(); 
        var X = C.lng(); 
        var Y = C.lat(); 

        var AmaxX = allowedBounds.getNorthEast().lng(); 
        var AmaxY = allowedBounds.getNorthEast().lat(); 
        var AminX = allowedBounds.getSouthWest().lng(); 
        var AminY = allowedBounds.getSouthWest().lat(); 

        if (X < AminX) {X = AminX;} 
        if (X > AmaxX) {X = AmaxX;} 
        if (Y < AminY) {Y = AminY;} 
        if (Y > AmaxY) {Y = AmaxY;} 
        //alert ("Restricting "+Y+" "+X); 
        map.setCenter(new GLatLng(Y,X)); 
      } 
   
  /* LIMITE DEPLACEMENT DEBUT */ 
   
  // Add a move listener to restrict the bounds range 
      GEvent.addListener(map, "move", function() { 
        checkBounds(); 
      }); 



   function showAddress(address) 
        { 
        if (geocoder) 
          { 
          geocoder.getLatLng(address, function(point) 
            { 
            if (!point) {alert(address + " not found");} 
            else 
              { 
              map.setCenter(point, 13); 
              } 
            }); 
          } 
        } 

   
  /* LIMITE DEPLACEMENT FIN */ 
     
      
   
   
   
  map.addOverlay(createMarker((new GLatLng(0)), "points_verts", "<h1>MODENA YVON</h1><h3>ROUTE DE ST SAUVEUR 26110</h3><h2>ST JALLE</h2><h4>Tel. 0475273147</h4>" )); 
   
       
   
   
   
  map.addOverlay(createMarker((new GLatLng( 44.4221675,4.8127802 )), "points_verts", "<h1>PERRIN LAURENT</h1><h3>Z I DU CLAVON 26230</h3><h2>VALAURIE</h2><h4>Tel. 0475986269</h4>" )); 
   
       
   
   
   
  map.addOverlay(createMarker((new GLatLng( 45.3040101,4.9343902 )), "points_verts", "<h1>USPIANI CLAUDE</h1><h3>LA GARE 26210</h3><h2>EPINOUZE</h2><h4>Tel. 0475317788</h4>" )); 
   
       
   
   
   
  map.addOverlay(createMarker((new GLatLng(0)), "points_verts", "<h1>SARL BACCHUS</h1><h3>STATION DU COLLET 38580</h3><h2>LE COLLET D'ALLEVARD</h2><h4>Tel. 0476451643</h4>" )); 
   

map.addOverlay(createMarker((new GLatLng( 45.3120190,5.9609691)), "points_verts", "<h1>EMISLIM</h1><h3>AVENUE DU GRESIVAUDAN 38570</h3><h2>TENCIN</h2><h4>Tel. 0627454865</h4>" ));
		
		?

		var boundaries = new GLatLngBounds(new GLatLng(43.12,2.3), new GLatLng(46.95,8));
		var limite = new GGroundOverlay("mask2.png", boundaries);

		
		map.addOverlay(limite);
    
		

	
	  }
	  
		}
	setTimeout('MakeMap()', 500);
    //]]>
    </script>
	
	
	
  </body>

</html>
   
   
   

1 réponse

  1. Bonjour. Je n'ai pas l'habitude de faire fonctionner IE6, mais plutôt de convaincre les gens de changer pour IE9 (8 si tu as XP [ http://www.microsoft.com/downloads/fr-fr/details.aspx?FamilyID=341c2ad5-8c3d-4347-8c03-08cdecd8852b ] , et avec le SP3 [ http://www.microsoft.com/downloads/fr-fr/details.aspx?FamilyID=2fcde6ce-b5fb-4488-8c50-fe22559d164e ] ) .