I have a map.js file. I defined the folln function in it
//outside the function
var clickHandle;
function init() {
document.getElementById('button-sidebar-hide').onclick = function()
{ return changeBodyClass('sidebar-right', 'nosidebar'); };
document.getElementById('button-sidebar-show').onclick = function()
{ return changeBodyClass('nosidebar', 'sidebar-right'); };
handleResize();
map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
GEvent.addListener(map,'moveend',function() {
updateMarkers();
});
GEvent.addListener(map,'zoomend',function() {
// remove the existing points
map.clearOverlays();
updateMarkers();
});
//map.setMapType(G_HYBRID_MAP);
map.setCenter(new GLatLng(centerLatitude, centerLongitude),
startZoom);
/* [listing 6-18] */
changeBodyClass('loading', 'standby');
/* [listing 6-18 end] */
updateMarkers();
clickHandle = GEvent.addListener(map, "click", function(overlay,
latlng) {
if (latlng) {
if(markerToAdd) map.removeOverlay(markerToAdd);
markerToAdd = new GMarker(latlng, {draggable:true,
icon:customIcons["new"]});
GEvent.addListener(markerToAdd, "click", function() {
var html = "<table>" +
"<input type='hidden' id='lat'
value='"+latlng.lat()
+"'/>" +
"<input type='hidden' id='lng'
value='"+latlng.lng()
+"'/>" +
"<tr><td>Name:</td> <td><input type='text'
id='name'/> </td> </tr>" +
"<tr><td>Address:</td> <td><input type='text'
id='address'/></td> </tr>" +
"<tr><td>Type:</td> <td><select id='type'>" +
"<option value='cool' SELECTED>Cool</option>"
+
"<option value='worth'>Worth</option>" +
"<option value='experience'>Experience</
option>" +
"</select> </td></tr>" +
"<tr><td></td><td><input type='button'
value='Save & Close' onclick='javascript:saveData();'/></td></tr>";
markerToAdd.openInfoWindow(html);
});
map.addOverlay(markerToAdd);
}
});
}
I want to remove the click Listener if a user in not online in
virapp.php.. a different file. I have included this js file in
virapp.php. Somehow I am not able to do that. I have implementd
removeClickListener also in map.js file
function removeClickListener() {
GEvent.removeListener(clickHandle);
}
but a call for this function if a user is not online does not work. I
am sure this is a scope problem. I am not a good js guy. Please help
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---