Google地图:未捕获的TypeError:输入错误

时间:2013-06-26 15:18:13

标签: google-maps

在几页上,我开始收到上述错误,但仅限于Chrome ...

以下是一些演示错误的简单代码:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?key=AIzaSyD4uPYa8gidHCvCzXxEAalEzkEh94MhZYg&sensor=false"></script>
<script>function initializeMap() {
    myLatlng = new google.maps.LatLng(42.791968,3.035231);
        var myOptions = {
        zoom: 8,
        center: myLatlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP
        }
        map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);

        marker = new google.maps.Marker({
        position: myLatlng, 
        map: map,
        title: 'Tonys Place - Luxury apartment near the beach'
        });   
}
google.maps.event.addDomListener(window, 'load', initializeMap);

</script>
</head>
<body>
<div id="map_canvas" style="width: 400px; height: 400px">
</div>
</body>
</html>

我很难过 - 任何想法都值得赞赏!!!

由于

1 个答案:

答案 0 :(得分:11)

我认为这是我最近遇到的问题。我通过在我的标记上添加'optimized:false'作为选项来解决它。

marker = new google.maps.Marker({
    position: myLatlng, 
    map: map,
    title: 'Tonys Place - Luxury apartment near the beach',
    optimized: false
});   

Marker Options