Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Land Marker v1.0</title>
- <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
- <meta charset="utf-8">
- <style>
- html, body, #map-canvas {
- height: 100%;
- margin: 0px;
- padding: 0px
- }
- </style>
- <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places"></script>
- <script>
- var map;
- var infowindow;
- function initialize() {
- var taipei = new google.maps.LatLng( 24.999866, 121.547356);
- map = new google.maps.Map(document.getElementById('map-canvas'), {
- center: taipei,
- zoom: 15
- });
- infowindow = new google.maps.InfoWindow();
- google.maps.event.addListener( map, 'click', function(event){
- map.setCenter( event.latLng);
- callAjax();
- });
- }
- function callAjax() {
- // https://developers.google.com/maps/documentation/javascript/3.exp/reference#PlaceResult
- // document.getElementById("myDiv").innerHTML="create...marker...";
- var xmlhttp;
- if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
- xmlhttp=new XMLHttpRequest();
- }
- else{// code for IE6, IE5
- xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
- }
- xmlhttp.onreadystatechange=function(){
- if (xmlhttp.readyState==4){
- if( xmlhttp.status==200){
- document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
- }
- else{
- alert("GG");
- }
- }
- }
- xmlhttp.open("GET","http://www.google.com", true);
- xmlhttp.send();
- }
- google.maps.event.addDomListener(window, 'load', initialize);
- </script>
- </head>
- <body>
- <div id="myDiv"></div>
- <div id="map-canvas"></div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment