hallo,
ik wil op mijn site een google map embedden (zie www.elderly.nl/mapvenster2.htm)
maar dan met 2 form-fields voor lat en long ipv 1 formfield met een naam.
de code die ik nu gebruik is:
vast bedankt, freddy
ik wil op mijn site een google map embedden (zie www.elderly.nl/mapvenster2.htm)
maar dan met 2 form-fields voor lat en long ipv 1 formfield met een naam.
de code die ik nu gebruik is:
Code:
<!--
copyright (c) 2009 Google inc.
You are free to copy and use this sample.
License can be found here: http://code.google.com/apis/ajaxsearch/faq/#license
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Vind uw GPS Tracker</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAVUn66sdBfqy0lGNBg2KZDRQPRNn6-iZYuSluCEmj2PCRmvI38hSEahLy0NbGvWv4tOkRivjfm2ek8Q" type="text/javascript"></script>
<script type="text/javascript">
var map;
var geocoder;
function initialize() {
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(51.633865, 4.933226), 18);
map.enableScrollWheelZoom();
map.enableContinuousZoom();
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.setMapType(G_HYBRID_MAP);
geocoder = new GClientGeocoder();
}
// addAddressToMap() is called when the geocoder returns an
// answer. It adds a marker to the map with an open info window
// showing the nicely formatted version of the address and the country code.
function addAddressToMap(response) {
map.clearOverlays();
if (!response || response.Status.code != 200) {
alert("Sorry, niets gevonden.");
} else {
place = response.Placemark[0];
point = new GLatLng(place.Point.coordinates[1],
place.Point.coordinates[0]);
marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml('De <B>GPS Tracker</B> bevind zich hier<BR>' + place.address + '<br>' +
'<i>Aangeboden door FunSys</i> ' );
}
}
// showLocation() is called when you click on the Search button
// in the form. It geocodes the address entered into the form
// and adds a marker to the map at that location.
function showLocation() {
var address = document.forms[0].q.value;
geocoder.getLocations(address, addAddressToMap);
}
// findLocation() is used to enter the sample addresses into the form.
function findLocation(address) {
document.forms[0].q.value = address;
showLocation();
}
</script>
</head>
<body onload="initialize()" onunload="GUnload()" style="font-family: Arial;border: 0 none;">
<!-- Creates a simple input box where you can enter an address
and a Search button that submits the form. //-->
<form action="#" onsubmit="showLocation(); return false;">
<p>
<b>Geef GPS coördinaten in:</b><BR>Let op de comma!
<input type="text" name="q" value="51.633865, 4.933226" class="address_input" size="40" />
<input type="submit" name="find" value="Zoeken!" />
</p>
</form>
<div id="map_canvas" style="width: 450px; height: 400px"></div>
</body>
</html>
vast bedankt, freddy
Laatst bewerkt: