Google maps Google Maps v3对象为空或未定义

Google maps Google Maps v3对象为空或未定义,google-maps,Google Maps,在IE7和IE8的这行代码中,我得到了“无法获取属性“3”的值:对象为null或未定义”,我不知道如何解决它。非常感谢您的帮助 marker = new google.maps.Marker 我不确定undefined是什么意思,因为我在前面的代码块中声明了变量。非常感谢您的帮助。。。http://jsfiddle.net/svuce/1/ function initialize() { var markers = new Array(); var locations = [

在IE7和IE8的这行代码中,我得到了“无法获取属性“3”的值:对象为null或未定义”,我不知道如何解决它。非常感谢您的帮助

marker = new google.maps.Marker
我不确定undefined是什么意思,因为我在前面的代码块中声明了变量。非常感谢您的帮助。。。http://jsfiddle.net/svuce/1/

function initialize() {
    var markers = new Array();
    var locations = [
      ['Donegal', 'Some text goes here<br />text', 'walking', -33.900542, 151.174856],
      ['Bondi Beach', 'Some text goes here<br />text', 'walking', -33.890542, 151.274856],
      ['Coogee Beach', 'Some text goes here<br />text', 'golfing', -33.923036, 151.259052],
      ['Cronulla Beach', 'Some text goes here<br />text', 'family', -34.028249, 151.157507],
      ['Manly Beach', 'Some text goes here<br />text', 'explore', -33.80010128657071, 151.28747820854187],
      ['Maroubra Beach', 'Some text goes here<br />text', 'cycling', -33.950198, 151.259302],
    ];


    var map = new google.maps.Map(document.getElementById('map-canvas'), {
      zoom: 10,
      center: new google.maps.LatLng(-33.92, 151.25),
      mapTypeId: google.maps.MapTypeId.ROADMAP
    });

    var infowindow = new google.maps.InfoWindow();
    var marker, i;

    for (i = 0; i < locations.length; i++) {  
        marker = new google.maps.Marker({
            position: new google.maps.LatLng(locations[i][3], locations[i][4]),
            map: map,
            icon: 'images/map_'+locations[i][2]+'_image.png'
        });

        markers.push(marker);

        var boxText = document.createElement("div");

      google.maps.event.addListener(marker, 'click', (function(marker, i) {
        return function() {
            boxText.style.cssText = "border: none 0; margin-top: 8px; background:#fff; padding: 8px;border:1px solid #877856;";
            boxText.innerHTML = locations[i][0]+"<br />"+locations[i][2]+"<br />"+locations[i][1]+"<img src='images/tipbox.png' class='infobox-arrow' />";

            $(".infobox-close").remove();

            var myOptions = {
                     content: boxText
                    ,disableAutoPan: false
                    ,maxWidth: 0
                    ,pixelOffset: new google.maps.Size(-140, -180)
                    ,zIndex: null
                    ,boxStyle: { 
                      opacity: 1
                      ,width: "280px"
                     }
                    ,closeBoxMargin: "12px 7px 0 0"
                    ,closeBoxURL: "http://www.google.com/intl/en_us/mapfiles/close.gif"
                    ,infoBoxClearance: new google.maps.Size(1, 1)
                    ,isHidden: false
                    ,pane: "floatPane"
                    ,enableEventPropagation: false
            };
            var ib = new InfoBox(myOptions);
          ib.open(map, marker);
        }
      })(marker, i));
    }

    // == shows all markers of a particular category, and ensures the checkbox is checked ==
      function show(category) {
        for (var i=0; i<locations.length; i++) {
          if (locations[i][2] == category) {
            markers[i].setVisible(true);
          }
        }
      }

      // == hides all markers of a particular category, and ensures the checkbox is cleared ==
      function hide(category) {
        for (var i=0; i<locations.length; i++) {
          if (locations[i][2] == category) {
            markers[i].setVisible(false);
          }
        }
      }

      // == show or hide the categories initially ==
        show("walking");
        hide("golfing");
        hide("family");
        hide("explore");
        hide("cycling");



        $("#activities .checkbox").click(function(){
            var cat = $(this).attr("value");

            // If checked
            if ($(this).is(":checked"))
            {
                show(cat);
            }
            else
            {
                hide(cat);
            }
        });
  };

  window.load = initialize();
函数初始化(){
var markers=新数组();
变量位置=[
[Donegal',此处有一些文字
text',walking',-33.900542151.174856], ['Bondi Beach',这里有一些文字
文字,'walking',33.890542151.274856], ['Coogee Beach','这里有一些文字
文字','golfing',-33.923036151.259052], ['Cronulla Beach',此处有一些文字
文字,'family',-34.028249151.157507], ['Manly Beach','此处有一些文字
文字','explore',-33.80010128657071151.28747820854187], ['Maroubra Beach',这里有一些文字
文字,'cycling',-33.950198151.259302], ]; var map=new google.maps.map(document.getElementById('map-canvas'){ 缩放:10, 中心:新谷歌地图LatLng(-33.92151.25), mapTypeId:google.maps.mapTypeId.ROADMAP }); var infowindow=new google.maps.infowindow(); var标记,i; 对于(i=0;i”+位置[i][2]+“
”+位置[i][1]+”; $(“.infobox close”).remove(); 变量myOptions={ 内容:boxText ,disableAutoPan:false ,最大宽度:0 ,pixelOffset:new google.maps.Size(-140,-180) ,zIndex:null ,boxStyle:{ 不透明度:1 ,宽度:“280px” } ,closeBoxMargin:“12px 7px 0” ,closeBoxURL:“http://www.google.com/intl/en_us/mapfiles/close.gif" ,infoBoxClearance:newgoogle.maps.Size(1,1) ,isHidden:错 ,窗格:“浮动窗格” ,enableEventPropagation:false }; var ib=新信息框(myOptions); ib.open(地图、标记); } })(marker,i)); } //==显示特定类别的所有标记,并确保选中复选框== 功能展示(类别){
对于(var i=0;i去掉数组最后一部分末尾的尾随逗号,这将导致IE中出现错误:

  ['Maroubra Beach', 'Some text goes here<br />text', 'cycling', -33.950198, 151.259302],
['Maroubra Beach',此处有一些文字
文字,'cycling',33.950198151.259302],
这一行怎么样:var infowindow=new google.maps.infowindow();-这行行行吗?错误可能来自您正在应用到标记构造函数中的某个参数-请尝试对它们进行编码