Hi,
I am implementing google map where I am picking up the latitude and
longitude from the database and dynamically creating the marker. Now I
need to create pop-up messages for each of the marker containing some
database driven data particular to that marker...But I am not able to
do the same. The example I have follwed only helped me to create the
pop-up message only for the last marker location. As I am into the
official network, hence not able to share my application... Though I
will provide the source code for the same. Kindly help me..plz plz plz
Also please let me know if you need anymore input from my side...
Source code:
script type="text/javascript">
//Declaring global variable
var map;
function wheelZoom(e) {
var mouseX, mouseY;
if (!e)
e = window.event;
mouseX = (e.layerX) ? e.layerX : e.offsetX;
mouseY = (e.layerY) ? e.layerY : e.offsetY;
var c = (e.target) ? e.target : e.srcElement;
while (c) {
mouseX += c.offsetLeft;
mouseY += c.offsetTop;
c = c.offsetParent;
if (c == map.getContainer())
break;
}
// This is the appropriate point for the cursor at the moment of
zooming in or out
var point = map.fromContainerPixelToLatLng(new GPoint(mouseX,
mouseY));
// Prevent from scrolling the page when zooming the map
if (window.event) {
e.returnValue = false;
} // IE
if (e.cancelable) {
e.preventDefault();
} // DOM-Standard
// Scroll to where the pointer is
if ((e.detail || -e.wheelDelta) < 0) {
map.zoomIn(point);
} else {
map.zoomOut(point);
}
}
function intialized(a, b, status) {
var color = "green";
var mapdiv = document.getElementById("map");
var storeIcon = new GIcon(G_DEFAULT_ICON);
markerOption1 = {
icon :storeIcon
};
if (GBrowserIsCompatible()) {
map = new GMap2(mapdiv, {
draggableCursor :'auto',
draggingCursor :'move'
});
var bounds = new GLatLngBounds();
var center = new GLatLng(0, 0);
map.setCenter(center, 0, G_NORMAL_MAP);
for (i = 0; i < a.length; i++) {
color = status[i];
if (color != undefined && color != "")
storeIcon.image =
"http://google.com/mapfiles/ms/micons/"
+ color.trim() + ".png";
else
storeIcon.image =
"http://google.com/mapfiles/ms/micons/
purple.png";
storeIcon.iconSize = new GSize(40, 40);
storeIcon.iconAnchor = new GPoint(0, 0);
storeIcon.infoWindowAnchor = new GPoint(46,34);
var point = new GLatLng(a[i], b[i]);
marker = new GMarker(point, markerOption1);
// copying pop-up start
GEvent.addListener(marker, 'mouseover',
function(){
marker.openExtInfoWindow(
map,
"extInfoWindow_coolBlues",
"<div><br>Hi!!! I am <b>Arindam
Kanjilal</b>... "+
"I am trying to implement the
Pop-up message event
for"+
" this <b>Bigbelly</b> customized
google map. So
please wish me luck</div>"
);
});
// copying pop-up end
map.addOverlay(marker);
bounds.extend(marker.getPoint());
}
map.setZoom(map.getBoundsZoomLevel(bounds));
map.setCenter(bounds.getCenter());
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
}
// Event-Listener for wheelZoom
GEvent.addDomListener(mapdiv, "DOMMouseScroll", wheelZoom);
GEvent.addDomListener(mapdiv, "mousewheel", wheelZoom);
}
function updateDBValue() {
latitude = document.myform.latitude1.value;
lat1 = latitude.replace("[", "");
lat2 = lat1.replace("]", "");
lat3 = lat2.split(",");
longitude = document.myform.longitude1.value;
lon1 = longitude.replace("[", "");
lon2 = lon1.replace("]", "");
lon3 = lon2.split(",");
status = document.myform.status.value;
stat1 = status.replace("[", "");
stat2 = stat1.replace("]", "");
stat3 = stat2.split(",");
if (lat3 != "" && lon3 != "") {
intialized(lat3, lon3, stat3);
}
}
</script>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---