我对 Internet Explorer 8 引发的一些错误感到有些困惑,但 Firefox 却没有。
我看到以下错误:
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
我正在使用以下文件...
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);
for (i = 0; i < 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);
}
}
// for toggleBounce, need to add ", toggleBounce" back into previous brackets.
function toggleBounce() {
if (marker.getAnimation() != null) {
marker.setAnimation(null);
} else {
marker.setAnimation(google.maps.Animation.BOUNCE);
}
}
</script>
位置.js:
var locations = [
[9.449062, 7.950439, 0],
[34.449062, 10.950439, 50]
];
关于为什么这不起作用的任何想法?任何致盲错误?
问候,
马特