google maps api 3 - Javascript errors on IE 8 -
i'm little confused errors being thrown internet explorer 8, not firefox.
i seeing following errors:
webpage error details user agent: mozilla/4.0 (compatible; msie 8.0; windwos nt 5.1; trident/4.0; .net clr 2.0.50727; .net clr 3.0.4506.2152; .net clr 3.5.30729) timestamp: wed, 13 jun 2012 08:33:22 utc message: object expected line: 3 char: 1 code: 0 uri: http://<ipaddress>/.../locations.js message: syntax error line: 34 char: 11 code: 0 uri: http://<ipaddress>/.../testmap1.html
i using following files...
testmap1.html:
<div id="map_canvas" style="width: 1200px; height: 700px;">map div foo</div> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script> <script type="text/javascript" src="/static/app/foo/locations.js"></script> <!--<script type="text/javascript" src="/static/app/foo/script.js"></script>--> <script type="text/javascript"> var centerpoint = new google.maps.latlng(9.449062,7.950439); var parliament = new google.maps.latlng(9.449062,7.950439); var parliament1 = new google.maps.latlng(34.449062,7.950439); var marker; var map; var i; function initialize() { var mapoptions = { zoom: 2, maptypeid: google.maps.maptypeid.hybrid, center: centerpoint }; map = new google.maps.map(document.getelementbyid("map_canvas"), mapoptions); (i = 0; < locations.length; i++) { marker = new google.maps.marker({ map:map, draggable: false, animation: google.maps.animation.drop, position: new google.maps.latlng(locations[i][0], locations[i][1]), }); google.maps.event.addlistener(marker, 'click', togglebounce); } } // togglebounce, need add ", togglebounce" previous brackets. function togglebounce() { if (marker.getanimation() != null) { marker.setanimation(null); } else { marker.setanimation(google.maps.animation.bounce); } } </script>
locations.js:
var locations = [ [9.449062, 7.950439, 0], [34.449062, 10.950439, 50] ];
any thoughts why wouldn't work? blinding errors?
regards,
matt
remove trailing comma line:
position: new google.maps.latlng(locations[i][0], locations[i][1]),
it causes problems in ies.
marker = new google.maps.marker({ map:map, draggable: false, animation: google.maps.animation.drop, position: new google.maps.latlng(locations[i][0], locations[i][1]) //removed comma });
Comments
Post a Comment