WB18 Google map in HTML control. With text and code this time.

Startbeitrag von Viggo Poulsen am 02.12.2014 10:25

Hi All

Very strange. Where did my message go ???

Anyway. I try Again:

I am working on implementing Google maps api V3 via a HTML control.
It Works, well almost. I can show maps, zoom, etc. But I have problems putting needles on the map (markers). Standard markers Work fine, but markers based on a PNG file does not Work.

In a Dynamic AWP site this Works fine. All the time.
In a Dynamic webdev site it does not Work. Never.
Guess what I need to Work with :-(

It seems like the HTML control simply cannot find the PNG file. If I hover the mouse over the place where the marker should be, the cursor changes and the title are shown, so the marker Works, just without showing itself.
I have placed the PNG file everywhere with no luck (

Now for the code. If you put this in a HTML control it should Work. The api key being used are one from this site: http://www.w3schools.com/googleAPI/google_maps_basic.asp . You should use your own.

Here you go:






html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map-canvas { height: 100% }




var myCenter=new google.maps.LatLng(56.82128493, 8.99939973);
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(56.82128493, 8.99939973),
zoom: 8
};
var map = new google.maps.Map(document.getElementById("map-canvas"),
mapOptions);
var marker=new google.maps.Marker({
position:myCenter,
title:"Hello World!",
draggable: true,
icon: '2.png'
});
marker.setMap(map);
}
google.maps.event.addDomListener(window, 'load', initialize);







Doc of Javascript: https://developers.google.com/maps/documentation/javascript/markers#add
Tutorial: http://www.w3schools.com/googleAPI/google_maps_basic.asp


Any help to get this working with a Dynamic webdev site are most welcome.
Best regards
Viggo Poulsen

Antworten:

Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.