谷歌地图infowindow不再显示

早上好,

我的一位前同事创建了一个应用程序,您可以通过邮政编码进行搜索,然后在5-40公里范围内的地图上放置标记(谷歌地图)。

这些地点是您要查找邮政编码40公里范围内的商店。 该函数本身仍在工作,只有信息窗口的信息不再有效。

我有几个网站使用此应用程序运行,但对于infowindow不再工作的所有网站。 难道谷歌本身已经在API中做了调整,我还需要在某个地方调整某些东西?

这是我的同事放在一起的代码,没有什么变化,但它不再工作了...是否有人在这里知道这个问题的任何事情,因为我无法弄清楚自己..

    <script type="text/javascript">
                        var geocoder;
                        var map;
                        function initialize() {
                            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);

<?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
            }
        }
?>
                        }

                        var infowindow = new google.maps.InfoWindow();

                        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: "images/pincard/wheel-icon.png",
                                title: naam
                            });

                            google.maps.event.addListener(marker, 'mouseover', function() {
                                var contentString = '<div>'+
                                '<b style="border-bottom: 1px solid #000000;">' + naam + '</b><br/>'+
                                'Afstand (hemelsbreed): ' + afstand + ' km<br/>' +
                                straat + '<br/>' +
                                postcode + ' ' + plaats + '<br/>';
                                if(telefoon != "")
                                {
                                    contentString = contentString + 'Telefoonnr: ' + telefoon;
                                }
                                contentString = contentString + '</div>';
                                infowindow.content = contentString;
                                infowindow.open(map, marker);
                            });

                            google.maps.event.addListener(marker, 'mouseout', function(){
                                infowindow.close(map);
                            });
                        }

                        google.maps.event.addDomListener(window, 'load', initialize);
                    </script>

我把这个叫做api:

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>

如果任何人有任何想法为什么所有网站的信息窗口停止工作,那么我很乐意听到,因为我不明白为什么它不再有效。

在此先感谢您的任何努力

亲切的问候,

的Joep

PS:这是一个网站,例如:

intertyre ... PHP?LANG = NL&P = 4


我被同样的问题困扰,并去Google搜索答案。

找到了我的问题的答案 - 它看起来像谷歌可能已经收紧了它的infoWindow API有点迫使你通过一个适当的Set()函数设置.content成员。

尝试更换线路

infowindow.content = contentString;

infowindow.setContent(contentString);

并看看是否有帮助。 我用我的代码做了这件事,并修复了破损。

链接地址: http://www.djcxy.com/p/6089.html

上一篇: Google maps infowindow doesnt show up anymore

下一篇: Getting/Parsing XML data from an API that is done in PHP