Google Map implementation not working on Safari and Chrome
I am implementing a google map on the contact page of this website: http://www.vqt.ch/dev/?lang=fr&page=contact
The map displays in the rectangle on the top of the page. Everything is working fine on Firefox, but nothing is displayed on Safari & Chrome...
Here is the way I implement it:
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA8yt4eBY5BILk0ExOfUVIuxTtIfr4IreHJHupahKP7IIqKlsN7BQG4crqM32UzthNoFP_54xDooNNNQ&sensor=true" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function createMarker(point,text) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(text); });
return marker;
}
function load() {
if (GBrowserIsCompatible()) {
var Lat=46.983707;
var Lng=6.904106;
var Zoom=13;
var TextAffiche="<strong>VQT<\/song>开发者_如何学JAVA<br/>Verre & Quartz Technique SA<br/><br/>Rue de Maillefer 11d<br/>2000 Neuchatel";
var map = new GMap2(document.getElementById("contactMap"));
map.setCenter(new GLatLng(Lat,Lng ),Zoom );
map.addControl(new GLargeMapControl3D());
map.addControl(new GMapTypeControl());
var point = new GLatLng(Lat,Lng);
var new_icon = new GIcon()
new_icon.image = "http://www.vqt.ch/gmap_marker.png";
new_icon.size = new GSize(50, 32);
new_icon.iconAnchor = new GPoint(0,0);
new_icon.infoWindowAnchor = new GPoint(0,0);
var opt;
opt = {};
opt.icon = new_icon;
opt.draggable = false;
opt.clickable = true;
opt.dragCrossMove = false;
var marker = new GMarker(point,opt);//createMarker(point,TextAffiche);
map.addOverlay(marker);
marker.openInfoWindowHtml(TextAffiche)
}
}
$("body").attr("onload", "load()");
$("body").attr("onunload", "GUnload()");
//]]>
</script>
and here is my html:
<div class="normalContent">
<div id="contactMap" class="borderedImages"></div>
</div>
Do you know what is wrong in there? I really don't understand why it's working somewhere and not working somewhere else...
Thank you for your help!
I restarted from a tutorial and it's now working: http://www.vqt.ch/dev/google_map_debug/
The main difference is the call of the load function, which now is on the body attributes:
<body onload="load()" onunload="GUnload()">
So I guess the problem was here... Thank you for your help!
精彩评论