Guest User

Untitled

a guest
Aug 13th, 2014
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3.   <head>
  4.     <title>Land Marker v1.0</title>
  5.     <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
  6.     <meta charset="utf-8">
  7.     <style>
  8.       html, body, #map-canvas {
  9.         height: 100%;
  10.         margin: 0px;
  11.         padding: 0px
  12.       }
  13.     </style>
  14.     <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places"></script>
  15.     <script>
  16. var map;
  17. var infowindow;
  18.  
  19.  
  20. function initialize() {
  21.   var taipei = new google.maps.LatLng( 24.999866, 121.547356);
  22.  
  23.   map = new google.maps.Map(document.getElementById('map-canvas'), {
  24.     center: taipei,
  25.     zoom: 15
  26.   });
  27.  
  28.   infowindow = new google.maps.InfoWindow();
  29.  
  30.   google.maps.event.addListener( map, 'click', function(event){
  31.     map.setCenter( event.latLng);
  32.     callAjax();
  33.   });
  34. }
  35.  
  36.  
  37. function callAjax() {
  38.   // https://developers.google.com/maps/documentation/javascript/3.exp/reference#PlaceResult
  39.   // document.getElementById("myDiv").innerHTML="create...marker...";
  40.   var xmlhttp;
  41.   if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
  42.     xmlhttp=new XMLHttpRequest();
  43.   }
  44.   else{// code for IE6, IE5
  45.     xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  46.   }
  47.   xmlhttp.onreadystatechange=function(){
  48.     if (xmlhttp.readyState==4){
  49.       if( xmlhttp.status==200){
  50.         document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
  51.       }
  52.       else{
  53.         alert("GG");  
  54.       }
  55.     }
  56.   }
  57.   xmlhttp.open("GET","http://www.google.com", true);
  58.   xmlhttp.send();
  59. }
  60.  
  61. google.maps.event.addDomListener(window, 'load', initialize);
  62.  
  63.     </script>
  64.   </head>
  65.   <body>
  66.     <div id="myDiv"></div>
  67.     <div id="map-canvas"></div>
  68.   </body>
  69. </html>
Advertisement
Add Comment
Please, Sign In to add comment