2013-06-17 3 views
0

사이드 바를 사용하는 Google지도 API 기능이 있습니다. 이것은 FireFox와 Chrome에서 훌륭하게 작동하지만 나는 실패했습니다! 나는 인터넷 검색으로 많은 다른 것들을 시도했지만 제대로 할 수없는 것 같습니다. 이건 내 코드입니다 :SCRIPT600 오류 Internet Explorer

    <script type="text/javascript"> 
         var geocoder; 
         var map; 
         var side_bar_html = ""; 
         var gmarkers = []; 
         var infobox; 
         function initialize() { 

           // Create an array of styles. 
    var blueOceanStyles = [ 
    { 
     featureType: "all", 
     elementType: "all", 
     stylers: [ 
     { saturation: -100 } // <-- THIS 
     ] 
    } 
]; 

          geocoder = new google.maps.Geocoder(); 
          var myOptions = { 
           zoom: <?php 
           if(is_array($postcodevelden) && count($postcodevelden) > 0 && !empty($_POST['address'])) 
           { 
            switch($radius) 
            { 
             case "5": 
              echo "12"; 
              break; 
             case "10": 
              echo "11"; 
              break; 
             case "15": 
             case "20": 
              echo "10"; 
              break; 
             case "30": 
             case "40": 
              echo "9"; 
              break; 
            } 
           } 
           else 
           { 
            echo "7"; 
           } 
           ?>, 
           center: new google.maps.LatLng(<?php if(is_array($postcodevelden) && count($postcodevelden) > 0) { echo $lat.", ".$lon; } else { echo "52.2008737173322, 5.25146484375"; } ?>),    
          mapTypeId: google.maps.MapTypeId.ROADMAP 
          } 
          map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); 
          map.setOptions({styles: blueOceanStyles}); 

<?php 
     if(is_array($adressen) AND count($adressen) > 0) 
     { 
      foreach($adressen as $adres) 
      { 
       $afstand = round((6371 * acos(sin(deg2rad($lat)) * sin(deg2rad($adres->locatie_lat)) + cos(deg2rad($lat)) * cos(deg2rad($adres->locatie_lat)) * cos(deg2rad($adres->locatie_lon) - (deg2rad($lon))))), 2); 
?> 
          addMarker(<?php echo $adres->locatie_lat.", ".$adres->locatie_lon.", '".$adres->locatie_naam."', '".$adres->locatie_straat."', '".$adres->locatie_postcode."', '".$adres->locatie_plaats."', '".$adres->locatie_telefoon."', '".$afstand."'"; ?>); 
<?php 
      } 
     } 
?> 
document.getElementById("marker_list").innerHTML = side_bar_html; 

         } 
         function myclick(i) { 
    map.setCenter(gmarkers[i].getPosition()); 
    google.maps.event.trigger(gmarkers[i], "click"); 
} 
          infowindow = new InfoBox({ 
          content: document.getElementById("infobox"), 
          disableAutoPan: false, 
          maxWidth: 150, 
          pixelOffset: new google.maps.Size(-140, 0), 
          zIndex: null, 
          boxStyle: { 
           background: "url('http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/examples/tipbox.gif') no-repeat", 
           opacity: 0.95, 
           width: "280px" 
          }, 
          closeBoxMargin: "12px 4px 2px 2px", 
          closeBoxURL: "http://www.google.com/intl/en_us/mapfiles/close.gif", 
          infoBoxClearance: new google.maps.Size(1, 1) 
         }); 

         function addMarker(lat, lon, naam, straat, postcode, plaats, telefoon, afstand) 
         { 
          var marker = new google.maps.Marker({ 
           position: new google.maps.LatLng(lat, lon), 
           map: map, 
           icon: "afbeeldingen/pincard/wheel-icon.png", 
           title: naam 
          }); 

          google.maps.event.addListener(marker, 'click', function() { 
           var contentString = '<div id="infobox">'+ 
           '<b style="border-bottom: 1px solid #f6ee34; color:#ee2a24;">' + naam + '</b><br/>'+ 
           straat + '<br/>' + 
           postcode + '<br/>' 
           + plaats + '<br/>'; 
           if(telefoon != "") 
           { 
            contentString = contentString + 'Telefoonnr: ' + telefoon; 
           } 
           contentString = contentString + '</div>'; 
           infowindow.setContent(contentString); 
           infowindow.open(map, marker); 
          }); 
           gmarkers.push(marker); 

    side_bar_html += '<tr>'+ '<td onclick="javascript:myclick(' + (gmarkers.length-1) + ')"><a>' + naam + '<br/>' + straat + '<br/>' + postcode + ' ' + plaats + '<br/>' + '<u>Afstand ' + afstand + ' km</u>' +'</td>' +'<\/a></tr><br>'; 

         } 

         google.maps.event.addDomListener(window, 'load', initialize); 
        </script> 
        <div> 
         <form action="index.php?p=5#keuze" method="POST"> 
                <select name="afstand"> 
             <option value="5"<?php if(isset($_POST['zoekpost']) && $_POST['zoekpost'] == "zoek" && $_POST['afstand'] == 5) { echo " selected=\"selected\""; } ?>>5 km</option> 
             <option value="10"<?php if(isset($_POST['zoekpost']) && $_POST['zoekpost'] == "zoek" && $_POST['afstand'] == 10) { echo " selected=\"selected\""; } ?>>10 km</option> 
             <option value="15"<?php if(isset($_POST['zoekpost']) && $_POST['zoekpost'] == "zoek" && $_POST['afstand'] == 15) { echo " selected=\"selected\""; } ?>>15 km</option> 
             <option value="20"<?php if(isset($_POST['zoekpost']) && $_POST['zoekpost'] == "zoek" && $_POST['afstand'] == 20) { echo " selected=\"selected\""; } ?>>20 km</option> 
             <option value="30"<?php if(isset($_POST['zoekpost']) && $_POST['zoekpost'] == "zoek" && $_POST['afstand'] == 30) { echo " selected=\"selected\""; } ?>>30 km</option> 
             <option value="40"<?php if(isset($_POST['zoekpost']) && $_POST['zoekpost'] == "zoek" && $_POST['afstand'] == 40) { echo " selected=\"selected\""; } ?>>40 km</option> 
          </select><br /> 
          <input id="address" name="address" type="textbox"<?php if(isset($_POST['zoekpost']) && $_POST['zoekpost'] == 'zoek') { echo " value=\"".$_POST['address']."\""; } ?>> 
          <input type="submit" name="zoekpost" id="zoekpost" value="zoek"> 
         </form> 
        </div> 
        <br/>     
        <br/> 
        <div class="mapborder"> 
        <div id="mapcontainer"> 
         <div id="map_canvas"></div> 
        </div> 
        </div> 

</div> 
<div id="content-right" style="overflow-y:auto; overflow-x:hidden; height:500px; width:462px; padding-top:0px; margin-top:170px; padding-bottom:0px;"><table id="marker_list"></table></div> 
<?php 
} 
} 
?> 

그리고이 라인을 일으키는 : 너무 Internet Explorer에서 잘 작동되도록

document.getElementById("marker_list").innerHTML = side_bar_html; 

어떻게이 오류를 해결할 수 있습니까? 나는 Google에서 발견 것들의 부하를 시도했지만 그들 중 누구도

감사합니다 사전에 ... 작업을하지 않습니다

친절 감사 중복 죄송합니다

+0

보다는, 그냥 우리를 보여주기 위해 간단 할 것 귀하의 페이지에있는 모든 JS 코드 – duncan

답변

0

...

내가 일을 가지고 .. 같은 ploblem 가지고

사람들 : 당신은 사업부에 테이블을 정의해야합니다

을 ...

그래서

document.getElementById("table_markers").innerHTML = side_bar_html; 

"table_markers는"사업부이며, 여기에 테이블을 넣어 : 저희에게 당신의 PHP를 포함하는 코드를 보여

side_bar_html += '<table id="marker_list"><tr>'+ '<td onclick="javascript:myclick(' + (gmarkers.length-1) + ')"><a>' + naam + '<br/>' + straat + '<br/>' + postcode + ' ' + plaats + '<br/>' + '<u>Afstand ' + afstand + ' km</u>' +'</td>' +'<\/a></tr></table><br>';