/ Published in: JavaScript
Expand |
Embed | Plain Text
<body onload"load()" onunload="GUnload()"> <div id="map" style="width: 622px; height: 320px" class="mapBlock"></div> <script type="text/javascript"> //<![CDATA[ if (GBrowserIsCompatible()) { // A function to create the marker and set up the event window // Dont try to unroll this function. It has to be here for the function closure // Each instance of the function preserves the contends of a different instance // of the "marker" and "html" variables which will be needed later when the event triggers. function createMarker(point,html) { var marker = new GMarker(point); GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; } // Display the map, with some controls and set the initial location var map = new GMap2(document.getElementById("map")); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng(37.332179,-122.032571),11); // Set up three markers with info windows var point = new GLatLng(37.332179,-122.032571); var marker = createMarker(point,'<div style="width:240px; font-size: 11px; font-family: Verdana, Arial, Helvetica, sans-serif; color: #000000;">Cupertino Inn<br \/>10889 N De Anza Blvd<br \/>Cupertino, CA 95014<br \/><a href="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=cupertino+inn&sll=37.0625,-95.677068&sspn=46.005754,76.289063&ie=UTF8&z=13&iwloc=A">Directions<\/a><\/div>') map.addOverlay(marker); } // display a warning if the browser was not compatible else { alert("Sorry, the Google Maps API is not compatible with this browser"); } // This Javascript is based on code provided by the // Blackpool Community Church Javascript Team // http://www.commchurch.freeserve.co.uk/ // http://econym.googlepages.com/index.htm //]]> </script>
You need to login to post a comment.
