javascript - 'var' is null or not an object -
the code works fine in firefox, not in ie8. i'm getting error: 'address' null or not object.
have been googling days , couldn't clear answer on how fix/debug this. hope stackoverflow.com can help.
var latlng = [ { address: new glatlng(-6.1364941,106.8000411), marker0: myicon0 }, { address: new glatlng(-6.1364941,106.8000411), marker0: myicon0 }, { address: new glatlng(1.3520831,103.8198361), marker0: myicon0 }, { address: new glatlng(14.06666671,121.33333331), marker0: myicon }, ]; var markers = []; ( var = 0; < latlng.length; i++ ) { var marker = new gmarker( latlng[ ].address, latlng[ ].marker0 ); map.addoverlay( marker ); markers[i] = marker; } $(markers).each(function(i,marker){ gevent.addlistener(marker,"click", function(){ // map.panto(marker.getlatlng()); map.setcenter(marker.getlatlng(), 10); marker.openinfowindowhtml($('.view-display-id-attachment_1 .views-row-'+(i+1)).html(), {maxwidth:200}); }); $("<li />") .html($('.view-display-id-attachment_1 .views-row-'+(i+1)).html()) .click(function(){ map.setcenter(marker.getlatlng(), 10); marker.openinfowindowhtml($('.view-display-id-attachment_1 .views-row-'+(i+1)).html(), {maxwidth:200}); // custom balloon text // alert($('.view-display-id-attachment_1 .views-row-'+(i+1)).html()); // views row count debug }) .appendto("#wtb-list"); });
the issue here:
marker0: myicon }, //<-- here! ];
that trailing comma @ end of array declaration give ie8 issues, remove :) other browsers..."overlook?" in cases, ie error on them.
Comments
Post a Comment