Click here to read about this example in my blog

Basic Marker Example

In this example a marker is added to a Google Map. The marker is draggable has a tooltip and an InfoWindow opens when you click it.

// Init the map
var map = new GMap2(document.getElementById('map'));
map.addControl(new GSmallMapControl());
map.setCenter(new GLatLng(59.5, 14.0), 6);

// Creating a marker
var marker = new GMarker(new GLatLng(59.0, 13.80), {
    draggable: true, 
    title: 'Drag me'

// Adding a click event to the marker
GEvent.addListener(marker, "click", function() {
    marker.openInfoWindow('My InfoWindow');

// Close InfoWindow at dragstart
GEvent.addListener(marker, "dragstart", function() {
// Add the marker to the map