오늘 :
983 / 3,233
어제 :
18,162 / 260,388
전체 :
20,083,531 / 275,692,361

Open API 공부

Naver, Daum, Google Open API

추천 수 : 15 / 0
조회 수 : 20752
2007.11.30 (11:13:04)


http://www.subkorea.com/api/google/MapsAPI/event-closure.htm마크부 클릭시 풍선도움말 생성

<!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" xmlns:v="urn:schemas-microsoft-com:vml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google Maps JavaScript API Example: Event Closures</title>
    <script src="http://maps.google.com/maps?file=api&v=2&key=abc...xyz"
            type="text/javascript"></script>
    <script type="text/javascript">
function initialize() {
  var message = ["This","is","the","secret","message"];

  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map_canvas"));
    map.setCenter(new GLatLng(37.4419, -122.1419), 13);
  
    // Creates a marker at the given point
    // Clicking the marker will hide it
    function createMarker(latlng, number) {
      var marker = new GMarker(latlng);
      marker.value = number;
      GEvent.addListener(marker,"click", function() {
        var myHtml = "<b>#" + number + "</b><br/>" + message[number -1];
        map.openInfoWindowHtml(latlng, myHtml);
      });
      return marker;
        }

    // Add 5 markers to the map at random locations
    // Note that we don't add the secret message to the marker's instance data
    var bounds = map.getBounds();
    var southWest = bounds.getSouthWest();
    var northEast = bounds.getNorthEast();
    var lngSpan = northEast.lng() - southWest.lng();
    var latSpan = northEast.lat() - southWest.lat();
    for (var i = 0; i < 5; i++) {
      var latlng = new GLatLng(southWest.lat() + latSpan * Math.random(),
            southWest.lng() + lngSpan * Math.random());
        map.addOverlay(createMarker(latlng, i + 1));
    }
  }
}
    </script>
  </head>
  <body onload="initialize()" onunload="GUnload()">
    <div id="map_canvas" style="width: 500px; height: 300px"></div>
  </body>
</html>

번호 제목 닉네임 등록일 조회 추천
12 event-bind 첨부 파일
cyber
2007-11-30 19755 19
11 event-arguments 첨부 파일
cyber
2007-11-30 19411 10
Selected event-closure 첨부 파일
cyber
2007-11-30 20752 15
9 event-context 첨부 파일
cyber
2007-11-30 20900 17
8 event-simple 첨부 파일
cyber
2007-11-30 19401 19
7 map-distance 첨부 파일
cyber
2007-11-30 21880 19
6 map-range 첨부 파일
cyber
2007-11-30 18715 27
5 map-dualmap 첨부 파일
cyber
2007-11-30 18103 15
4 map-infowindow 첨부 파일
cyber
2007-11-30 18226 16
3 map-animate 첨부 파일
cyber
2007-11-30 18564 12
Tag List