Step 1: Javascript function not dragable google marker map
<html>
<head>
<script src="js/maps.js"
type="text/javascript"></script>
<script type="text/javascript">
function load() {
if (GBrowserIsCompatible()) {
var map = new
GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
var center = new
GLatLng(28.550610, 77.270856);
map.setCenter(center, 14);
map.setMapType(); //type
declate map/satlite/hybrid
geocoder =
new GClientGeocoder();
var marker = new
GMarker(center);
map.addOverlay(marker);
document.getElementById("lat").value =
center.lat();
document.getElementById("lng").value =
center.lng();
geocoder =
new GClientGeocoder();
GEvent.addListener(marker, function () {
var point = marker.getPoint();
map.panTo(point);
document.getElementById("lat").value =
point.lat();
document.getElementById("lng").value =
point.lng();
});
GEvent.addListener(map, function () {
map.clearOverlays();
var center = map.getCenter();
var marker = new
GMarker(center);
map.addOverlay(marker);
document.getElementById("lat").value =
center.lat();
document.getElementById("lng").value =
center.lng();
GEvent.addListener(marker, function () {
var point = marker.getPoint();
map.panTo(point);
document.getElementById("lat").value =
point.lat();
document.getElementById("lng").value
= point.lng();
});
});
}
}
function showAddress() {
var num = document.forms["form1"]["address"].value;
var map = new
GMap2(document.getElementById("map"));
map.addControl(new
GSmallMapControl());
map.addControl(new
GMapTypeControl());
if (geocoder) {
geocoder.getLatLng(
num,
function
(point) {
if (!point) {
alert(num +
" city not found !");
}
else {
document.getElementById("lat").value =
point.lat();
document.getElementById("lng").value =
point.lng();
map.clearOverlays()
map.setCenter(point,
14);
var marker = new
GMarker(point);
map.addOverlay(marker);
GEvent.addListener(marker, function () {
var pt = marker.getPoint();
map.panTo(pt);
document.getElementById("lat").value = pt.lat();
document.getElementById("lng").value = pt.lng();
});
GEvent.addListener(map, function () {
map.clearOverlays();
var center = map.getCenter();
var marker = new
GMarker(center);
map.addOverlay(marker);
document.getElementById("lat").value =
center.lat();
document.getElementById("lng").value =
center.lng();
GEvent.addListener(marker, function () {
var pt = marker.getPoint();
map.panTo(pt);
document.getElementById("lat").value = pt.lat();
document.getElementById("lng").value = pt.lng();
});
});
}
}
);
}
}
</script>
</head>
<body
onload="load()"
onunload="GUnload()">
<form id="form1"
runat="server">
<script type="text/javascript"
language="JavaScript">
<!--
var message = "";
function clickIE() { if
(document.all) { (message); return
false; } }
function clickNS(e) {
if
(document.layers || (document.getElementById
&& !document.all)) {
if (e.which == 2 || e.which == 3) { (message);
return false; }
}
}
if (document.layers)
{
document.captureEvents(Event.MOUSEDOWN); document.onmousedown = clickNS; }
else { document.onmouseup = clickNS;
document.oncontextmenu = clickIE; }
document.oncontextmenu = new Function("return
false")
// -->
</script>
<div align="center"
id="map"
style="width:
674px; height:
300px;">
</div>
</form>
</body>
</html>
Step 2: map.js file register
<script src="js/maps.js"
type="text/javascript"></script>
function
GScript(src) { document.write('<' +
'script src="' + src +
'"' +
' type="text/javascript"><'
+
'/script>'); } function
GBrowserIsCompatible() { return
true; } function
GApiInit()
{ if
(GApiInit.called) return; GApiInit.called =
true; window.GAddMessages && GAddMessages({
160:
'\x3cH1\x3eServer Error\x3c/H1\x3eThe
server encountered a temporary error
and could not complete your
request.\x3cp\x3ePlease try again
in a minute or so.\x3c/p\x3e',
1415:
'.', 1416: ',',
1547: 'mi', 1616:
'km', 4100: 'm', 4101:
'ft', 10018:
'Loading...',
10021:
'Zoom In', 10022:
'Zoom Out', 10024: 'Drag to zoom',
10029: 'Return to the
last result',
10049: 'Map', 10050: 'Satellite',
10093: 'Terms of Use', 10111: 'Map',
10112:
'Sat', 10116:
'Hybrid', 10117: 'Hyb', 10120:
'We are sorry, but we don\x27t
have maps at
this zoom level for
this region.\x3cp\x3eTry zooming out
for a broader
look.\x3c/p\x3e',
10121: 'We are sorry, but we don\x27t have imagery at
this zoom
level
for this
region.\x3cp\x3eTry zooming out for a broader
look.\x3c/p\x3e', 10507:
'Pan left',
10508: 'Pan right', 10509:
'Pan up', 10510:
'Pan down', 10511: 'Show
street map',
10512: 'Show satellite imagery', 10513: 'Show
imagery with street names',
10806:
'Click to see this area on Google Maps',
10807: 'Traffic', 10808:
'Show Traffic',
10809:
'Hide Traffic', 12150:
'%1$s on %2$s', 12151:
'%1$s on %2$s at %3$s', 12152:
'%1$s on %2$s
between %3$s and %4$s',
10985: 'Zoom in', 10986:
'Zoom out', 11047:
'Center map
here', 11089:
'\x3ca href\x3d\x22javascript:void(0);\x22\x3eZoom
In\x3c/a\x3e
to see traffic
for this region',
11259: 'Full-screen', 11751: 'Show
street map with
terrain',
11752: 'Style:', 11757: 'Change map
style', 11758: 'Terrain',
11759: 'Ter',
11794:
'Show labels', 11303:
'Street View Help', 11274:
'To use street view, you
need Adobe Flash Player
version %1$d or newer.', 11382: 'Get the
latest Flash Player.',
11314:
'We\x27re sorry, street view is
currently unavailable due to high demand.\x3cbr\x3ePlease
try
again later!', 1559: 'N',
1560: 'S', 1561: 'W',
1562: 'E', 1608: 'NW',
1591:
'NE',
1605: 'SW', 1606:
'SE', 11907: 'This image is no longer
available', 10041:
'Help',
12471: 'Current Location', 12492:
'Earth', 12823:
'Google has disabled usage
of the Maps API
for this
application. See the Terms of Service for more
information:
%1$s.',
12822: 'http://code.google.com/apis/maps/terms.html',
12915: 'Improve the
map',
12916: 'Google, Europa Technologies', 13171: 'Hybrid
3D', 0: '' }); } var
GLoad; (function
() { GLoad = function (apiCallback) {
var callee = arguments.callee;
GApiInit();
var opts = { export_legacy_names:
true, tile_override: [{ maptype: 0,
min_zoom:
"7", max_zoom: "7",
rect: [{ lo: { lat_e7: 330000000, lng_e7: 1246050000
}, hi: { lat_e7: 386200000,
lng_e7: 1293600000} }, { lo: { lat_e7: 366500000, lng_e7:
1297000000 }, hi: { lat_e7:
386200000, lng_e7: 1314843700}}], uris: ["http://mt0.gmaptiles.co.kr/mt/v=kr1.17\x26hl=en\x26src=api\x26",
"http://mt1.gmaptiles.co.kr/mt/v=kr1.17\x26hl=en\x26src=api\x26",
"http://mt2.gmaptiles.co.kr/mt/v=kr1.17\x26hl=en\x26src=api\x26",
"http://mt3.gmaptiles.co.kr/mt/v=kr1.17\x26hl=en\x26src=api\x26"]
}, { maptype:
0, min_zoom:
"8", max_zoom: "8",
rect: [{ lo: { lat_e7: 330000000, lng_e7: 1246050000
}, hi: { lat_e7: 386200000,
lng_e7: 1279600000} }, { lo: { lat_e7: 345000000, lng_e7:
1279600000 }, hi: { lat_e7:
386200000, lng_e7: 1286700000} }, { lo: { lat_e7: 354690000,
lng_e7: 1286700000 }, hi: {
lat_e7: 386200000, lng_e7: 1314843700}}], uris: ["http://mt0.gmaptiles.co.kr/mt/v=kr1.17\x26hl=en\x26src=api\x26",
"http://mt1.gmaptiles.co.kr/mt/v=kr1.17\x26hl=en\x26src=api\x26",
"http://mt2.gmaptiles.co.kr/mt/v=kr1.17\x26hl=en\x26src=api\x26",
"http://mt3.gmaptiles.co.kr/mt/v=kr1.17\x26hl=en\x26src=api\x26"]
}, { maptype:
0, min_zoom:
"9", max_zoom: "9",
rect: [{ lo: { lat_e7: 330000000, lng_e7: 1246050000
}, hi: { lat_e7: 386200000,
lng_e7: 1279600000} }, { lo: { lat_e7: 340000000, lng_e7:
1279600000 }, hi: { lat_e7:
386200000, lng_e7: 1286700000} }, { lo: { lat_e7: 348900000,
lng_e7: 1286700000 }, hi: {
lat_e7: 386200000, lng_e7: 1302000000} }, { lo: { lat_e7:
368300000, lng_e7: 1302000000
}, hi: { lat_e7: 386200000, lng_e7: 1314843700}}],
uris: ["http://mt0.gmaptiles.co.kr/mt/v=kr1.17\x26hl=en\x26src=api\x26",
"http://mt1.gmaptiles.co.kr/mt/v=kr1.17\x26hl=en\x26src=api\x26",
"http://mt2.gmaptiles.co.kr/mt/v=kr1.17\x26hl=en\x26src=api\x26",
"http://mt3.gmaptiles.co.kr/mt/v=kr1.17\x26hl=en\x26src=api\x26"]
}, { maptype: 0, min_zoom:
"10", max_zoom:
"19", rect: [{ lo: { lat_e7: 329890840,
lng_e7: 1246055600 }, hi: {
lat_e7: 386930130, lng_e7: 1284960940} }, { lo: { lat_e7:
344646740, lng_e7: 1284960940
}, hi: { lat_e7: 386930130, lng_e7: 1288476560} },
{ lo: { lat_e7: 350277470,
lng_e7: 1288476560 }, hi: { lat_e7: 386930130, lng_e7:
1310531620} }, { lo: {
lat_e7: 370277730, lng_e7: 1310531620 }, hi: { lat_e7: 386930130,
lng_e7: 1314843700}}], uris:
["http://mt0.gmaptiles.co.kr/mt/v=kr1.17\x26hl=en\x26src=api\x26",
"http://mt1.gmaptiles.co.kr/mt/v=kr1.17\x26hl=en\x26src=api\x26",
"http://mt2.gmaptiles.co.kr/mt/v=kr1.17\x26hl=en\x26src=api\x26",
"http://mt3.gmaptiles.co.kr/mt/v=kr1.17\x26hl=en\x26src=api\x26"]
}, { maptype:
3, min_zoom:
"7", max_zoom: "7",
rect: [{ lo: { lat_e7: 330000000, lng_e7: 1246050000
}, hi: { lat_e7: 386200000,
lng_e7: 1293600000} }, { lo: { lat_e7: 366500000, lng_e7:
1297000000 }, hi: { lat_e7:
386200000, lng_e7: 1314843700}}], uris: ["http://mt0.gmaptiles.co.kr/mt/v=kr1p.17\x26hl=en\x26src=api\x26",
"http://mt1.gmaptiles.co.kr/mt/v=kr1p.17\x26hl=en\x26src=api\x26",
"http://mt2.gmaptiles.co.kr/mt/v=kr1p.17\x26hl=en\x26src=api\x26",
"http://mt3.gmaptiles.co.kr/mt/v=kr1p.17\x26hl=en\x26src=api\x26"]
}, { maptype:
3, min_zoom:
"8", max_zoom: "8",
rect: [{ lo: { lat_e7: 330000000, lng_e7: 1246050000
}, hi: { lat_e7: 386200000,
lng_e7: 1279600000} }, { lo: { lat_e7: 345000000, lng_e7:
1279600000 }, hi: { lat_e7:
386200000, lng_e7: 1286700000} }, { lo: { lat_e7: 354690000,
lng_e7: 1286700000 }, hi: {
lat_e7: 386200000, lng_e7: 1314843700}}], uris: ["http://mt0.gmaptiles.co.kr/mt/v=kr1p.17\x26hl=en\x26src=api\x26",
"http://mt1.gmaptiles.co.kr/mt/v=kr1p.17\x26hl=en\x26src=api\x26",
"http://mt2.gmaptiles.co.kr/mt/v=kr1p.17\x26hl=en\x26src=api\x26",
"http://mt3.gmaptiles.co.kr/mt/v=kr1p.17\x26hl=en\x26src=api\x26"]
}, { maptype:
3, min_zoom:
"9", max_zoom: "9",
rect: [{ lo: { lat_e7: 330000000, lng_e7: 1246050000
}, hi: { lat_e7: 386200000,
lng_e7: 1279600000} }, { lo: { lat_e7: 340000000, lng_e7:
1279600000 }, hi: { lat_e7:
386200000, lng_e7: 1286700000} }, { lo: { lat_e7: 348900000,
lng_e7: 1286700000 }, hi: {
lat_e7: 386200000, lng_e7: 1302000000} }, { lo: { lat_e7:
368300000, lng_e7: 1302000000
}, hi: { lat_e7: 386200000, lng_e7: 1314843700}}],
uris: ["http://mt0.gmaptiles.co.kr/mt/v=kr1p.17\x26hl=en\x26src=api\x26",
"http://mt1.gmaptiles.co.kr/mt/v=kr1p.17\x26hl=en\x26src=api\x26",
"http://mt2.gmaptiles.co.kr/mt/v=kr1p.17\x26hl=en\x26src=api\x26",
"http://mt3.gmaptiles.co.kr/mt/v=kr1p.17\x26hl=en\x26src=api\x26"]
}, { maptype: 3, min_zoom:
"10", rect: [{ lo: { lat_e7: 329890840,
lng_e7: 1246055600
}, hi: { lat_e7: 386930130,
lng_e7: 1284960940} }, { lo: { lat_e7: 344646740, lng_e7:
1284960940 }, hi: { lat_e7:
386930130, lng_e7: 1288476560} }, { lo: { lat_e7: 350277470,
lng_e7: 1288476560 }, hi: {
lat_e7: 386930130, lng_e7: 1310531620} }, { lo: { lat_e7:
370277730, lng_e7: 1310531620
}, hi: { lat_e7: 386930130, lng_e7: 1314843700}}],
uris: ["http://mt0.gmaptiles.co.kr/mt/v=kr1p.17\x26hl=en\x26src=api\x26",
"http://mt1.gmaptiles.co.kr/mt/v=kr1p.17\x26hl=en\x26src=api\x26",
"http://mt2.gmaptiles.co.kr/mt/v=kr1p.17\x26hl=en\x26src=api\x26",
"http://mt3.gmaptiles.co.kr/mt/v=kr1p.17\x26hl=en\x26src=api\x26"]}],
jsmain:
"http://maps.gstatic.com/intl/en_ALL/mapfiles/400d/maps2.api/main.js",
obliques_urls:
["http://khm0.googleapis.com/kh?v=64\x26src=app\x26",
"http://khm1.googleapis.com/kh?v=64\x26src=app\x26"],
token:
"1590487805", jsmodule_base_url:
"http://maps.gstatic.com/intl/en_ALL/mapfiles/400d/maps2.api",
generic_tile_urls: ["http://mt0.googleapis.com/vt?hl=en\x26src=api\x26",
"http://mt1.googleapis.com/vt?hl=en\x26src=api\x26"],
ignore_auth:
false, sv_host:
"http://cbk0.google.com" }; apiCallback(["http://mt0.googleapis.com/vt/lyrs\x3dm@196000000\x26hl\x3den\x26src\x3dapi\x26",
"http://mt1.googleapis.com/vt/lyrs\x3dm@196000000\x26hl\x3den\x26src\x3dapi\x26"],
["http://khm0.googleapis.com/kh/v\x3d120\x26src\x3dapp\x26",
"http://khm1.googleapis.com/kh/v\x3d120\x26src\x3dapp\x26"],
["http://mt0.googleapis.com/vt/lyrs\x3dh@196000000\x26hl\x3den\x26src\x3dapi\x26",
"http://mt1.googleapis.com/vt/lyrs\x3dh@196000000\x26hl\x3den\x26src\x3dapi\x26"],
"",
"", "",
true, "google.maps.",
opts, ["http://mt0.googleapis.com/vt/lyrs\x3dt@129,r@196000000\x26hl\x3den\x26src\x3dapi\x26",
"http://mt1.googleapis.com/vt/lyrs\x3dt@129,r@196000000\x26hl\x3den\x26src\x3dapi\x26"]);
if
(!callee.called) { callee.called = true; } }
})(); function GUnload() {
if (window.GUnloadApi)
{ GUnloadApi(); } }
var _mIsRtl = false;
var _mHost = "http://maps.google.com";
var
_mUri = "/maps"; var
_mDomain = "google.com";
var _mStaticPath =
"http://maps.gstatic.com/intl/en_ALL/mapfiles/";
var
_mJavascriptVersion = G_API_VERSION = "400d";
var _mTermsUrl =
"http://www.google.com/intl/en_ALL/help/terms_maps.html";
var
_mLocalSearchUrl = "http://www.google.com/uds/solutions/localsearch/gmlocalsearch.js";
var
_mHL = "en"; var
_mGL = ""; var
_mTrafficEnableApi = true;
var _mTrafficTileServerUrls
= ["http://mt0.google.com/mapstt",
"http://mt1.google.com/mapstt",
"http://mt2.google.com/mapstt",
"http://mt3.google.com/mapstt"];
var _mCityblockLatestFlashUrl =
"http://maps.google.com/local_url?dq=&q=http://www.adobe.com/shockwave/download/download.cgi%3FP1_Prod_Version%3DShockwaveFlash&s=ANYYN7nf7Bnil-2aQPpooGehMQSeRyv0Tg";
var
_mCityblockFrogLogUsage = false;
var _mCityblockInfowindowLogUsage =
false;
var
_mCityblockUseSsl = false;
var _mSatelliteToken =
"fzwq2gAgHBR1LnSaO7wjpXnSzu8CIc24-YDV_w";
var
_mMapCopy = "Map data \x26#169;2012 ";
var _mSatelliteCopy =
"Imagery \x26#169;2012
"; var _mGoogleCopy
= "\x26#169;2012
Google"; var _mPreferMetric =
false; var _mDirectionsEnableApi
=
true; var _mLayersTileBaseUrls = ['http://mt0.google.com/mapslt',
'http://mt1.google.com/mapslt',
'http://mt2.google.com/mapslt',
'http://mt3.google.com/mapslt'];
var _mLayersFeaturesBaseUrl
=
"http://mt0.google.com/vt/ft"; function
GLoadMapsScript() { if (!GLoadMapsScript.called
&& GBrowserIsCompatible()) {
GLoadMapsScript.called = true; GScript("http://maps.gstatic.com/intl/en_ALL/mapfiles/400d/maps2.api/main.js");
} } (function
() { if (!window.google) window.google = {};
if (!window.google.maps)
window.google.maps = {};
var ns = window.google.maps;
ns.BrowserIsCompatible = GBrowserIsCompatible;
ns.Unload = GUnload; })();
GLoadMapsScript();