谷歌地图标记没有在IE上显示在地图上

时间:2014-06-05 15:15:07

标签: xml image internet-explorer google-maps-api-3 google-maps-markers

由于IE,我真的处于停滞状态。所以我有一个带有地图的网站,我正在使用geocodezip的js扩展名从XML文件下载数据,以放置标记和相应的信息窗口。当我使用Firefox,Chrome和Safari打开网站时,一切正常,但标记不会显示在IE上。但是,我也使用单独的标记来对用户的位置进行地理定位,这也适用于IE,所以我不确定问题是图像,我定义标记还是xml下载部分。由于某种原因,我的横幅divs的揭示模式也不适用于IE,但这是我正在研究的另一个问题。该网站仍然是WIP,但我将其暂停几天:Website

这是我定义图标图像然后标记本身的地方:

    var image = {
        url: 'Images/shibatiny.png',
        scaledSize: new google.maps.Size(90,44),
        origin: new google.maps.Point(0, 0),
        anchor: new google.maps.Point(45,22)    
        //backgroundPosition: "-50 0"
    };
        var marker = new google.maps.Marker({
            position: latlng,
            icon: image,
            shape: shape,
            map: map,
            title: name,
            zIndex: Math.round(latlng.lat()*-100000)<<5
        });

这是我从xml下载数据并定义infowindow内容'html'的部分(对于凌乱的代码感到遗憾,需要清理它):

        downloadUrl("XML/database.xml", function(doc) {
            var xml = xmlParse(doc);
            var markers = xml.documentElement.getElementsByTagName("marker");
            for (var i = 0; i < markers.length; i++) {
                var lat = parseFloat(markers[i].getAttribute("lat"));
                var lng = parseFloat(markers[i].getAttribute("lng"));
                var point = new google.maps.LatLng(lat,lng);
                var name = markers[i].getAttribute("name");
                var category1 = markers[i].getAttribute("category1");
                var category2 = markers[i].getAttribute("category2");
                var address = markers[i].getAttribute("address");
                var city = markers[i].getAttribute("city");
                var postcode = markers[i].getAttribute("postcode"); 
                var state = markers[i].getAttribute("state");   
                var country = markers[i].getAttribute("country");
                var phone = markers[i].getAttribute("phone");   
                var email = markers[i].getAttribute("email");
                var website = markers[i].getAttribute("website");
                var description = markers[i].getAttribute("description");
                var facebook = markers[i].getAttribute("facebook");     
                var twitter = markers[i].getAttribute("twitter");                                                                                                   
                var html = '<div id="infoWindow">';
                html += '<b style="font-size:16px; line-height:100%">'+name+'<\/b>';
                html += '<br/><img width="350px" height="6px" src="Images/line1.png"><br/><p style="color:#676868; line-height:2px !important">'+address+'<\/p>';
                html += '<p style="color:#676868; line-height:2px !important">'+city+', '+postcode+'<\/p>';
                html += '<p style="color:#676868; line-height:2px !important">';                    
                if (state) {var html = html + state+', '};                  
                html += ''+country+'<\/p>';
                if (phone) {var html = html + '<p style="padding-top:5px !important; line-height:2px !important"><b>Phone: <\/b>'+phone+'<\/p>'};
                if (website) {var html = html + '<p style="line-height:2px !important"><b>Web: <\/b>'+website+'<\/p>'};
                if (email) {var html = html + '<p style="line-height:2px !important"><b>Email: <\/b>'+email+'<\/p>'};                   
                //if (phone) {var html = html + '<b>Phone: <\/b>'+phone+'<br/>'};       
                //if (website) {var html = html + '<b>Web: <\/b>'+website+'<br/>'};     
                //if (email) {var html = html + '<b>Email: <\/b>'+email+'<br/>'};               
                if (description) {var html = html + '<p>"' +description+ '"<\/p>'};
                if (website) {var html = html + '<div class="infoweb"><a target="_blank" href="'+website+'">Website</a></div>'};
                if (email) {var html = html + '<div class="infoweb"><a href="mailto:'+email+'">Email</a></div>'};
                if (phone) {var html = html + '<div class="infoweb"><a href="tel:'+phone+'">Call</a></div>'};                   
                html += '<br/>';
                //html += '<a target="_blank" href="'+website+'">Website<br/><br/><\/a>';               
                //html += '<\/div>';
                html += '<div class="infoweb2">';
                if (email) {var html = html + '<a href="mailto:'+email+'" style="text-decoration:none"><img class="infobottom" width="30px" src="Images/emailsmall.png"> <\/a>'};
                if (facebook) {var html = html + '<a target="_blank" href="'+facebook+'" style="text-decoration:none"><img class="infobottom" width="30px" src="Images/facebooksmall.png"> <\/a>'};                 
                if (twitter) {var html = html + '<a target="_blank" href="'+twitter+'" style="text-decoration:none"><img class="infobottom" width="30px" src="Images/twittersmall.png"><\/a>'}; 
                var html = html + '<\/div>';            
                var html = html + '<\/div>'; //(if use this, remove html += '<\/div>'; )
                var marker = createMarker(point,name,html,category1,category2,address,country,city);
            }

1 个答案:

答案 0 :(得分:0)

我收到了一个javascript错误:

Webpage error details

Message: 'documentElement' is null or not an object
Line: 571
Char: 8
Code: 0
URI: http://www.dogeglobal.com/

IE认为your XML无效。

The XML page cannot be displayed 
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. 

--------------------------------------------------------------------------------

An invalid character was found in text content. Error processing resource 'http://www.dogeglobal.com/XML/database.xml'. Li...

<marker lat="49.222402" lng="17.654174" name="CEU Servers" category1="web" category2="Computer Service" address="J.A. Bat...

它有字符编码问题。 w3.org