Guest User

Untitled

a guest
Jul 26th, 2013
75
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <head>
  3. <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
  4.  
  5. <script type="text/javascript">
  6. var directionDisplay;
  7. var directionsService = new google.maps.DirectionsService();
  8. function initialize() {
  9. var latlng = new google.maps.LatLng(51.764696,5.526042);
  10. directionsDisplay = new google.maps.DirectionsRenderer();
  11. var myOptions = {
  12. zoom: 14,
  13. center: latlng,
  14. mapTypeId: google.maps.MapTypeId.ROADMAP,
  15. mapTypeControl: false
  16. };
  17. var map = new google.maps.Map(document.getElementById("map_canvas"),myOptions);
  18. directionsDisplay.setMap(map);
  19. directionsDisplay.setPanel(document.getElementById("directionsPanel"));
  20. var marker = new google.maps.Marker({
  21. position: latlng,
  22. map: map,
  23. title:"My location"
  24. });
  25. }
  26. function calcRoute() {
  27. var start = document.getElementById("routeStart").value;
  28. var end = "51.764696,5.526042";
  29. var request = {
  30. origin:start,
  31. destination:end,
  32. travelMode: google.maps.DirectionsTravelMode.DRIVING
  33. };
  34. directionsService.route(request, function(response, status) {
  35. if (status == google.maps.DirectionsStatus.OK) {
  36. directionsDisplay.setDirections(response);
  37. }
  38. });
  39. }
  40. </script>
  41. </head>
  42. <body>
  43. <body onload="initialize()">
  44. <div id="map_canvas" style="width:710px; height:300px"></div>
  45. <form action="" onsubmit="calcRoute();return false;" id="routeForm">
  46. <input type="text" id="routeStart" value="">
  47. <input type="submit" value="Route plannen">
  48. </form>
  49. <div id="directionsPanel"></div>
RAW Paste Data