-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
hi
we need to change a javascript codes related to google map in editproperty.ascx file but i dont know anything about googlemap api v3. can anyone change this code to map v3?
<script type="text/javascript">
function KeyDownHandler()
{
// process only the Enter key
if (event.keyCode == 13)
{
alert(event.keyCode);
// cancel the default submit
event.returnValue=false;
event.cancel = true;
showAddress(address.value);
}
}
function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
geocoder = new GClientGeocoder();
<asp:literal id="litMapCenter" runat="server" />
<asp:placeholder id="phMapLoad" runat="server">
var marker = new GMarker(center, {draggable: true});
map.addOverlay(marker);
document.getElementById("<%= txtLatitude.ClientID %>").value = center.lat().toFixed(5);
document.getElementById("<%= txtLongitude.ClientID %>").value = center.lng().toFixed(5);
GEvent.addListener(marker, "dragend", function() {
var point = marker.getPoint();
map.panTo(point);
document.getElementById("<%= txtLatitude.ClientID %>").innerHTML = point.lat().toFixed(5);
document.getElementById("<%= txtLongitude.ClientID %>").innerHTML = point.lng().toFixed(5);
});
GEvent.addListener(map, "moveend", function() {
map.clearOverlays();
var center = map.getCenter();
var marker = new GMarker(center, {draggable: true});
map.addOverlay(marker);
document.getElementById("<%= txtLatitude.ClientID %>").value = center.lat().toFixed(5);
document.getElementById("<%= txtLongitude.ClientID %>").value = center.lng().toFixed(5);
GEvent.addListener(marker, "dragend", function() {
var point =marker.getPoint();
map.panTo(point);
document.getElementById("<%= txtLatitude.ClientID %>").value = point.lat().toFixed(5);
document.getElementById("<%= txtLongitude.ClientID %>").value = point.lng().toFixed(5);
});
});
</asp:placeholder>
}
}
function showAddress(address) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + " not found");
} else {
document.getElementById("<%= txtLatitude.ClientID %>").value = point.lat().toFixed(5);
document.getElementById("<%= txtLongitude.ClientID %>").value = point.lng().toFixed(5);
map.clearOverlays()
map.setCenter(point, 14);
var marker = new GMarker(point, {draggable: true});
map.addOverlay(marker);
GEvent.addListener(marker, "dragend", function() {
var pt = marker.getPoint();
map.panTo(pt);
document.getElementById("<%= txtLatitude.ClientID %>").value = pt.lat().toFixed(5);
document.getElementById("<%= txtLongitude.ClientID %>").value = pt.lng().toFixed(5);
});
GEvent.addListener(map, "moveend", function() {
map.clearOverlays();
var center = map.getCenter();
var marker = new GMarker(center, {draggable: true});
map.addOverlay(marker);
document.getElementById("<%= txtLatitude.ClientID %>").value = center.lat().toFixed(5);
document.getElementById("<%= txtLongitude.ClientID %>").value = center.lng().toFixed(5);
GEvent.addListener(marker, "dragend", function() {
var pt = marker.getPoint();
map.panTo(pt);
document.getElementById("<%= txtLatitude.ClientID %>").value = pt.lat().toFixed(5);
document.getElementById("<%= txtLongitude.ClientID %>").value = pt.lng().toFixed(5);
});
});
}
}
);
}
}
if (window.addEventListener)
{
window.addEventListener("load", load, false);
window.attachEvent("onunload", GUnload);
}
else if (window.attachEvent)
{
window.attachEvent("onload", load);
//window.addEventListener("unload", GUnload, false);
}
</script>
Metadata
Metadata
Assignees
Labels
No labels