Bekijk de onderstaande video om te zien hoe je onze site als een web app op je startscherm installeert.
Opmerking: Deze functie is mogelijk niet beschikbaar in sommige browsers.
Hoe ziet je volledige index.html/php er nu uit?
Het is mogelijk dat je iets vergeten bent in te laden
<!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">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps</title>
</head>
<body onload="load()" onunload="GUnload()">
<script src="http://maps.google.nl/maps?file=api&v=2&key=ABQIAAAA_Sg9KB9fS0B6Jtnx32Gv3hQSvsc_gX5igSWMXt6QKdt3uZVFwBTOTlCQtRRwrtZP5u0DOF97rcL0eQ
" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var map;
var geocoder;
function load() {
if (GBrowserIsCompatible()) {
geocoder = new GClientGeocoder();
map = new GMap2(document.getElementById('map'));
map.addControl(new GSmallMapControl());
map.setCenter(new GLatLng(52.372246, 4.894409), 6);
map.setZoom(6);
}
}
function searchLocations() {
var address = document.getElementById('addressInput').value;
geocoder.getLatLng(address, function(latlng) {
if (!latlng) {
alert(address + ' Geen resultaten gevonden');
} else {
searchLocationsNear(latlng);
}
});
}
function searchLocationsNear(center) {
var radius = document.getElementById('radiusSelect').value;
var searchUrl = 'phpsqlsearch_genxml.php?lat=' + center.lat() + '&lng=' + center.lng() + '&radius=' + radius;
GDownloadUrl(searchUrl, function(data) {
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName('marker');
map.clearOverlays();
var sidebar = document.getElementById('sidebar');
sidebar.innerHTML = '';
if (markers.length == 0) {
sidebar.innerHTML = 'Geen resultaten gevonden';
map.setCenter(new GLatLng(52.372246, 4.894409), 10);
return;
}
var bounds = new GLatLngBounds();
for (var i = 0; i < markers.length; i++) {
var name = markers[i].getAttribute('name');
var address = markers[i].getAttribute('address');
var telefoon = markers[i].getAttribute('telefoon');
var fax = markers[i].getAttribute('fax');
var website = markers[i].getAttribute('website');
var email = markers[i].getAttribute('email');
var distance = parseFloat(markers[i].getAttribute('distance'));
var point = new GLatLng(parseFloat(markers[i].getAttribute('lat')),
parseFloat(markers[i].getAttribute('lng')));
var marker = createMarker(point, name, address, telefoon, fax, website, email);
map.addOverlay(marker);
var sidebarEntry = createSidebarEntry(marker, name, address, distance);
sidebar.appendChild(sidebarEntry);
bounds.extend(point);
}
map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
});
}
function createMarker(point, name, address, telefoon, fax, website, email) {
var marker = new GMarker(point);
var html =
'<b>' + name + '</b><br/>
' + address + '</b><br/>
<br/>
T: ' + telefoon + '</b><br/>
F: ' + fax + '</b><br/>
<br/>
<a href="' + website + '" target="_blank">' + website + '</a><br/>
<a href="mailto:' + email + '">' + email + '</a><br/>
<br/>
<a href="#" onclick="calcRoute('+ point +')"> routebeschrijving</a></b>';
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
function calcRoute(end) {
var start = document.getElementById('addressInput').value;
var request =
{
origin:start,
destination:end,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(result, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(result);
} else {
alert(status);
}
});
}
function createSidebarEntry(marker, name, address, distance) {
var div = document.createElement('div');
var html = '<b>' + name + '</b> (' + distance.toFixed(1) + ' km)<br/>' + address;
div.innerHTML = html;
div.style.cursor = 'pointer';
div.style.marginBottom = '2px';
GEvent.addDomListener(div, 'click', function() {
GEvent.trigger(marker, 'click');
});
GEvent.addDomListener(div, 'mouseover', function() {
div.style.backgroundColor = '#eee';
});
GEvent.addDomListener(div, 'mouseout', function() {
div.style.backgroundColor = '#fff';
});
return div;
}
</script>
<script>
function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
}
</script>
<font style="font-family:Arial, sans-serif; font-size:11px;">
<table width="100%">
<tr>
<td width="50%">
<input type="text" value="Postcode/Woonplaats" id="addressInput" style="color:#666;" onfocus="clearText(this);clearStyle(this);" />
</td>
<td width="50%">
<select id="radiusSelect">
<option value="" selected>Kies Straal</option>
<option value="5">5 km</option>
<option value="10">10 km</option>
<option value="25">25 km</option>
<option value="50">50 km</option>
<option value="100">100 km</option>
</select>
</td>
</tr>
<tr>
<td>
<input type="button" onclick="searchLocations()" value="Zoek Groothandels"/>
</td>
<td>
</td>
</tr>
</table>
</font><br/>
<br/>
<div style="width:445px; font-family:Arial, sans-serif; font-size:11px;>
<table>
<tbody>
<tr id="cm_mapTR">
<td> <div id="map" style="overflow: hidden; width:400px; height:400px"></div><br><div id="sidebar" style="overflow: auto; height: 200px; font-size: 11px; color: #000; width: 400px"></div></td>
</tr>
</tbody>
</table>
<br />
</body>
</html>
<script src="http://maps.google.nl/maps?file=api&v=2&key=ABQIAAAA_Sg9KB9fS0B6Jtnx32Gv3hQSvsc_gX5igSWMXt6QKdt3uZVFwBTOTlCQtRRwrtZP5u0DOF97rcL0eQ" type="text/javascript"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<title>Google Maps AJAX + mySQL/PHP Example</title>
<script src="http://maps.google.com/maps/api/js?sensor=false"
type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var map;
var markers = [];
var infoWindow;
var locationSelect;
function load() {
map = new google.maps.Map(document.getElementById("map"), {
center: new google.maps.LatLng(52.372246, 4.894409),
zoom: 6,
mapTypeId: 'roadmap',
mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}
});
infoWindow = new google.maps.InfoWindow();
locationSelect = document.getElementById("locationSelect");
locationSelect.onchange = function() {
var markerNum = locationSelect.options[locationSelect.selectedIndex].value;
if (markerNum != "none"){
google.maps.event.trigger(markers[markerNum], 'click');
}
};
}
function searchLocations() {
var address = document.getElementById("addressInput").value;
var geocoder = new google.maps.Geocoder();
geocoder.geocode({address: address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
searchLocationsNear(results[0].geometry.location);
} else {
alert(address + ' not found');
}
});
}
function clearLocations() {
infoWindow.close();
for (var i = 0; i < markers.length; i++) {
markers[i].setMap(null);
}
markers.length = 0;
locationSelect.innerHTML = "";
var option = document.createElement("option");
option.value = "none";
option.innerHTML = "See all results:";
locationSelect.appendChild(option);
}
function searchLocationsNear(center) {
clearLocations();
var radius = document.getElementById('radiusSelect').value;
var searchUrl = 'phpsqlsearch_genxml.php?lat=' + center.lat() + '&lng=' + center.lng() + '&radius=' + radius;
downloadUrl(searchUrl, function(data) {
var xml = parseXml(data);
var markerNodes = xml.documentElement.getElementsByTagName("marker");
var bounds = new google.maps.LatLngBounds();
for (var i = 0; i < markerNodes.length; i++) {
var name = markerNodes[i].getAttribute("name");
var address = markerNodes[i].getAttribute("address");
var telefoon = markerNodes[i].getAttribute("telefoon");
var fax = markerNodes[i].getAttribute("fax");
var email = markerNodes[i].getAttribute("email");
var website = markerNodes[i].getAttribute("website");
var distance = parseFloat(markerNodes[i].getAttribute("distance"));
var latlng = new google.maps.LatLng(
parseFloat(markerNodes[i].getAttribute("lat")),
parseFloat(markerNodes[i].getAttribute("lng")));
createOption(name, distance, i);
createMarker(latlng, name, address, telefoon, fax, website, email);
bounds.extend(latlng);
}
map.fitBounds(bounds);
locationSelect.style.visibility = "visible";
locationSelect.onchange = function() {
var markerNum = locationSelect.options[locationSelect.selectedIndex].value;
google.maps.event.trigger(markers[markerNum], 'click');
};
});
}
function createMarker(latlng, name, address, telefoon, fax, email, website) {
var html = "<font style='font-family:Arial, sans-serif; font-size:11px;'><b>" + name + "</b> <br/>" + address + "<br><br>" + telefoon + "<br>" + fax + "<br><br>" + website + "<br>" + email + "<br><br><a href='#' onclick='calcRoute()'>routebeschrijving</a></b></font>";
var marker = new google.maps.Marker({
map: map,
position: latlng
});
google.maps.event.addListener(marker, 'click', function() {
infoWindow.setContent(html);
infoWindow.open(map, marker);
});
markers.push(marker);
}
function calcRoute(end) {
var start = document.getElementById('addressInput').value;
var request =
{
origin:start,
destination:end,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(result, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(result);
} else {
alert(status);
}
});
}
function createOption(name, distance, num) {
var option = document.createElement("option");
option.value = num;
option.innerHTML = name + "(" + distance.toFixed(1) + ")";
locationSelect.appendChild(option);
}
function downloadUrl(url, callback) {
var request = window.ActiveXObject ?
new ActiveXObject('Microsoft.XMLHTTP') :
new XMLHttpRequest;
request.onreadystatechange = function() {
if (request.readyState == 4) {
request.onreadystatechange = doNothing;
callback(request.responseText, request.status);
}
};
request.open('GET', url, true);
request.send(null);
}
function parseXml(str) {
if (window.ActiveXObject) {
var doc = new ActiveXObject('Microsoft.XMLDOM');
doc.loadXML(str);
return doc;
} else if (window.DOMParser) {
return (new DOMParser).parseFromString(str, 'text/xml');
}
}
function doNothing() {}
//]]>
</script>
</head>
<body style="margin:0px; padding:0px;" onload="load()">
<div>
<script>
function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
}
</script>
<font style="font-family:Arial, sans-serif; font-size:11px;">
<table width="100%">
<tr>
<td width="50%">
<input type="text" value="Postcode/Woonplaats" id="addressInput" style="color:#666;" onfocus="clearText(this);clearStyle(this);" />
</td>
<td width="50%">
<select id="radiusSelect">
<option value="" selected>Kies Straal</option>
<option value="5">5 km</option>
<option value="10">10 km</option>
<option value="25">25 km</option>
<option value="50">50 km</option>
<option value="100">100 km</option>
</select>
</td>
</tr>
<tr>
<td>
<input type="button" onclick="searchLocations()" value="Zoek Groothandels"/>
</td>
<td>
</td>
</tr>
</table>
</font>
</div>
<div id="map" style="overflow: hidden; width:400px; height:400px"><br>
<div id="locationSelect" style="overflow: auto; height: 200px; font-size: 11px; color: #000; width: 400px"></div></div>
<div><select id="locationSelect" style="width:100%;visibility:hidden"></select></div>
</body>
</html>
<?xml version="1.0"?>
header ("content-type: text/xml");
<?xml version="1.0"?>
We gebruiken essentiële cookies om deze site te laten werken, en optionele cookies om de ervaring te verbeteren.