简体   繁体   English

地址解析器Internet Explorer问题

[英]geocoder internet explorer issue

Hello everyone , 大家好

i'm trying to use the google map API to display some adresses on my website. 我正在尝试使用Google Map API在我的网站上显示一些地址。 The problem is that doesn't work on IE...my code is like this : 问题是在IE上不起作用...我的代码是这样的:

function displayAdress (address) {

geocoder = new google.maps.Geocoder();
geocoder.geocode( { 'address': address}, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK) {
        var myOptions = {
            zoom: 15,
            center: results[0].geometry.location,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        var map = new google.maps.Map(document.getElementById("gmap-event"),myOptions); ////$("div[id^='map_canvas']").first()
        var marker = new google.maps.Marker({
            map: map,
            position: results[0].geometry.location
        });
    } else {
        alert(
        /*"Geocode was not successful for the following reason: " + status*/
        'Google map was unable to found the address: '+ address
        );
    }
});

When i use on IE, the log console throws a problem on geocoder = new google.maps.Geocoder(); 当我在IE上使用时,日志控制台在geocoder = new google.maps.Geocoder();上引发问题geocoder = new google.maps.Geocoder();

Did someone ever had this problem? 有人遇到过这个问题吗? Thanks for helping. 感谢您的帮助。

Thomas. 托马斯。

我的猜测(因为您没有包含足够的上下文)是您的页面上有一个id =“ geocode”的元素,并且没有在全局上下文中的javascript中声明“ var geocode”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM