Genau wie im Titel - warum Google Map Code blockiert meine anderen js Skripte? Ich habe den folgenden Code in der Kopfzeile:Warum Google Map Code blockiert meine anderen js Skripte?
<script type="text/javascript">
/* Sets up the map with markers */
function starter()
{
var latlng = new google.maps.LatLng(38.60427939057251, -9.07470703125);
var myOptions = {
zoom: 4,
center: latlng,
navigationControl: true,
scaleControl: false,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("tab14"), myOptions);
/* Sets up markers */
markers = [];
infoWindow = new google.maps.InfoWindow();
for (var i = 0, coordinates; coordinates = data.coords[i]; i++)
{
var iconImage = new google.maps.MarkerImage("http://map.lgfl.org.uk/images/arrow_green.png");
var LatLng = new google.maps.LatLng(coordinates.latitude, coordinates.longitude);
var marker = new google.maps.Marker({position: LatLng, icon: iconImage });
var contentString = '<div>'+
'<a href='+coordinates.url+'><h4>'+coordinates.title+'</h4></a>'+
'<div>'+
'<p><a href='+coordinates.url+'>'+coordinates.excerpt+'</a></p>'+
'</div>'+
'</div>';
addMarker(marker, contentString);
markers.push(marker);
}
/* Sets up marker clusterer */
var markerCluster = new MarkerClusterer(map, markers);
function addMarker(marker, content)
{
google.maps.event.addListener(marker, 'click', function() {
infoWindow.setContent(content);
infoWindow.open(map, marker);
});
}
}
window.onload = starter;
</script>
Und jetzt, wenn ich irgendwelche anderen js Code enthalten sein soll, etwas anderes auf der Seite zu tun, tut sie es nicht, weil dieser Codes. Wenn ich das window.onload = Starterzeile auskommentiere, funktioniert alles gut. Kann mir bitte jemand sagen, was mache ich hier falsch?
Versuchen Sie, die window.onload Funktion wieder für andere Skripte zu benutzen? – polarblau
Ja, ich mache das mit anderen Skripten, warum? Ist das der Fall? – Pavel