webnick2008
02-11-2008, 06:44 AM
Hi, This seems to be working fine in FF but throws an error in IE7. I create an array in my function and then use it in other functions. It's global but IE doesn't like something about the syntax??
You can see the first marker doesn't set up on the map but, after clicking show/hide, it actually throws the error.
http://www.strans.org/hotspots/t.phpfunction pageInit()
{ // set up map and stuff
map = new Map('mapContainer', 'geography', 'Missoula, MT', 6); // Create and display Map object at address with zoom level. Include your application ID.
map.addTool(new PanTool(), true); // Make the map draggable
map.addWidget(new SatelliteControlWidget()); // Add Widgets to the map and display them
marker = []; // Create a marker object, then add the POI marker to the map
marker[1] = new CustomPOIMarker('Free Cycles', '', '732 S. 1st St W. <br />Missoula, MT 59801 <br /><br />Free Cycles Missoula is a volunteer <br />effort providing bikes, parts and help for <br />those in need. (406) 541-PATH', '', '');
map.addMarkerByAddress(marker[1], '732 S. 1st St. W., Missoula, MT 59801');
if(document.getElementById('addform'))
{
document.getElementById('mapContainer').style.height = '380px';
map.setZoomLevel(4);
}
else { // BIG map
map.addWidget(new NavigatorWidget());
map.addEventListener(Map.EVENT_INITIALIZE, mapMarkers); // addMarkers after map loads
hideLevels(); // close up the markers list
}
}
function moveMap( _levelId, location )
{// Recenter map if an address link is clicked on webpage
map.setCenterByAddress(location);
map.setZoomLevel(4);
marker[ _levelId ].open();
showLevel( _levelId, location );
pageTracker._trackPageview( '/hotspot/mapview/'+ _levelId +'/'+ location ); // hit google analytics
}
<a href="javascript:moveMap( '1227','S. Russell St. and S. 7th St., Missoula, MT' );">S. Russell St. and S. 7th St., Missoula, MT</a>
The error 'marker is null or not an object':function moveMap( _levelId, location ) ....
marker[ _levelId ].open();
You can see the first marker doesn't set up on the map but, after clicking show/hide, it actually throws the error.
http://www.strans.org/hotspots/t.phpfunction pageInit()
{ // set up map and stuff
map = new Map('mapContainer', 'geography', 'Missoula, MT', 6); // Create and display Map object at address with zoom level. Include your application ID.
map.addTool(new PanTool(), true); // Make the map draggable
map.addWidget(new SatelliteControlWidget()); // Add Widgets to the map and display them
marker = []; // Create a marker object, then add the POI marker to the map
marker[1] = new CustomPOIMarker('Free Cycles', '', '732 S. 1st St W. <br />Missoula, MT 59801 <br /><br />Free Cycles Missoula is a volunteer <br />effort providing bikes, parts and help for <br />those in need. (406) 541-PATH', '', '');
map.addMarkerByAddress(marker[1], '732 S. 1st St. W., Missoula, MT 59801');
if(document.getElementById('addform'))
{
document.getElementById('mapContainer').style.height = '380px';
map.setZoomLevel(4);
}
else { // BIG map
map.addWidget(new NavigatorWidget());
map.addEventListener(Map.EVENT_INITIALIZE, mapMarkers); // addMarkers after map loads
hideLevels(); // close up the markers list
}
}
function moveMap( _levelId, location )
{// Recenter map if an address link is clicked on webpage
map.setCenterByAddress(location);
map.setZoomLevel(4);
marker[ _levelId ].open();
showLevel( _levelId, location );
pageTracker._trackPageview( '/hotspot/mapview/'+ _levelId +'/'+ location ); // hit google analytics
}
<a href="javascript:moveMap( '1227','S. Russell St. and S. 7th St., Missoula, MT' );">S. Russell St. and S. 7th St., Missoula, MT</a>
The error 'marker is null or not an object':function moveMap( _levelId, location ) ....
marker[ _levelId ].open();