Error in executing google maps, related to script error

Asked

Viewed 254 times

0

Estou com um erro na chamada do painel do google maps, em html:

Apresenta o seguinte erro:

    insira o código aqui

Script error
http://maps.google.com/maps-api-v3/api/js/24/12/intl/pt_br/util.js

A linha que chama é 
mapDisplay.setPanel(document.getElementById("panel"))

Código completo:
<!DOCTYPE html>
<html>
<script type="text/javascript" src=""></script><script type='text/javascript' src='http://maps.google.com/maps/api/js?v=3.24&language=pt-BR'></script>
<script type='text/javascript'>
var map, geocoder;
var mapDisplay, directionsService;
function initialize() {
var myOptions = {zoom: 15,mapTypeId: google.maps.MapTypeId.ROADMAP};
map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);
geocoder = new google.maps.Geocoder();
var enderDe =  'Rua Maranhao, 1575,VILA VELHA,ES,29101340';
var enderAte = 'Rua Maranhao, 2575,VILA VELHA,ES,29101340';
geocoder.geocode( { 'address': enderAte, 'region' : 'BR'},trataLocs);
initializeDirections ();
calcRota (enderDe, enderAte);
}
function initializeDirections () {
 directionsService = new google.maps.DirectionsService();
 mapDisplay = new google.maps.DirectionsRenderer();
 mapDisplay.setMap(map);
 mapDisplay.setPanel(document.getElementById("panel"));
}
function calcRota(endDe, endPara) {
    var request = {
        origin:endDe, 
        destination:endPara,
        waypoints: [{location:'VARZEA ALEGRE,,SANTA MARIA DE JETIBA,ES,'},{location:'GARRAFAO,,SANTA MARIA DE JETIBA,ES,'}],
        travelMode: google.maps.DirectionsTravelMode.DRIVING
    };
    directionsService.route(request, function(response, status) {
      if (status == google.maps.DirectionsStatus.OK) {
        mapDisplay.setDirections(response);
      }
    });
  }
function trataLocs (results, status) {
var elem = document.getElementById('msg');
if (status == google.maps.GeocoderStatus.OK) {
 map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map, 
position: results[0].geometry.location  });
if (results.length > 1) {
 var i, txt = '<select style="font-family:Verdana;font-size:8pt;width=550px;" onchange="mostraEnd(this.options[this.selectedIndex].text);">';
 elem.innerHTML = 'O endereço exato não foi localizado - há ' +  results.length.toString() + ' resultados aproximados.<br />';
 for (i = 0; i < results.length; i++) {
 txt = txt + '<option value="' + i.toString() + '"';
 if (i == 0)
   txt = txt + ' selected="selected"'; 
 txt = txt + '>' + results[i].formatted_address + '</option>';
}
txt = txt + '</select>'
 elem.innerHTML = elem.innerHTML + txt;
 }
} else
 elem.innerHTML = 'Erro no tratamento do endereço :<br /><b>' + status + '</b>';
 }
</script>
  </head>
  <body onload='initialize();' style='font-family:Verdana;font-size:8pt;margin:5px 0 5px 0;'>
  <center> 
    <div id='msg'></div> 
    <div id='map_canvas' style='width:550px;height:450px'></div>
    <div id='panel' style='width:550px;height:450px'></div>
    </center> 
  </body>
</html>
  • Nilton, please add to your question the full code that makes the call to the maps, as well as if posśivel adds the javascript tag to it, to improve the visualization for those who can really understand the subject.

  • @Brunobermann <!DOCTYPE html> <html><script type="text/javascript" src=""></script><script type='text/javascript' src='http://maps.google.com/maps/api/js?v=3.24&sensor=false&language=pt-BR'></script> <script type='text/javascript'>var map, geocoder; var mapDisplay, directionsService;function initialize() {&#xA;var myOptions = {zoom: 15,mapTypeId: google.maps.MapTypeId.ROADMAP};&#xA;map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);

  • @BrunoBermann geocoder = new google.maps.Geocoder();var enderDe = 'Rua Maranhao, 1575';var enderAte = 'Rua Maranhao,2575';geocoder.geocode( { 'address': enderAte, 'region' : 'BR'},trataLocs);initializeDirections ();calcRota (enderDe, enderAte);&#xA;}

  • Nilton, please edit your question to give greater visibility to the code. I will analyze and if I discover something forward an answer.

  • 1

    Solved with adjustment in regedit. HKEY_LOCAL_MACHINE SOFTWARE Wow6432node Microsoft Internet Explorer MAIN Featurecontrol FEATURE_BROWSER_EMULATION

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.