오늘 :
20,319 / 180,249
어제 :
20,268 / 186,367
전체 :
20,534,104 / 280,624,220

Open API 공부

Naver, Daum, Google Open API

추천 수 : 12 / 0
조회 수 : 16302
2007.11.30 (13:08:46)


http://www.subkorea.com/api/google/MapsAPI/marker-tabbed.html마크별로 다른 tab(1-4개 설명문) 있음

<!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">
  <head>
    <title>Google Maps</title>
    <script src="http://maps.google.com/maps?file=api&v=2&key=abc...xyz" type="text/javascript"></script>
  </head>
  <body onunload="GUnload()">

    <!-- the div where the map will be displayed -->
    <div id="map" style="width: 550px; height: 450px"></div>
    <a href="basic10.htm">Back to the tutorial page</a>

    <!-- fail nicely if the browser has no Javascript -->
    <noscript><b>JavaScript must be enabled in order for you to use Google Maps.</b>
      However, it seems JavaScript is either disabled or not supported by your browser.
      To view Google Maps, enable JavaScript by changing your browser options, and then
      try again.
    </noscript>




    <script type="text/javascript">
    //<![CDATA[

    // Check to see if this browser can run the Google API
    if (GBrowserIsCompatible()) {
    
    
      // ==================================================
      // A function to create a tabbed marker and set up the event window
      // This version accepts a variable number of tabs, passed in the arrays htmls[] and labels[]
      function createTabbedMarker(point,htmls,labels) {
        var marker = new GMarker(point);
        GEvent.addListener(marker, "click", function() {
          // adjust the width so that the info window is large enough for this many tabs
          if (htmls.length > 2) {
            htmls[0] = '<div style="width:'+htmls.length*88+'px">' + htmls[0] + '</div>';
          }
          var tabs = [];
          for (var i=0; i<htmls.length; i++) {
            tabs.push(new GInfoWindowTab(labels[i],htmls[i]));
          }
          marker.openInfoWindowTabsHtml(tabs);
        });
        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(43.907787,-79.359741), 9);
    
      // ==================================================
      // Set up the tabbed markers
    
      var point = new GLatLng(43.82589,-79.10040);
      var marker = createTabbedMarker(point, ["Tab 1 contents", "Tab 2 contents","Tab 3 contents"],["One","Two","Three"]);
      map.addOverlay(marker);
      
      var point = new GLatLng(43.72589,-79.8);
      var marker = createTabbedMarker(point, ["Tab 1 contents", "Tab 2 contents","Tab 3 contents","Tab 4 contents"],["One","Two","Three","Four"]);
      map.addOverlay(marker);
      
      var point = new GLatLng(43.65654,-79.90138);
      var marker = createTabbedMarker(point, ["is the time for all good men<br>to come to the aid of the party", "a dangerous temptation comes to us<br>in gay, fine colours"],["Now", "Many"]);
      map.addOverlay(marker);

      var point = new GLatLng(43.8,-79.3);
      var marker = createTabbedMarker(point, ["This marker has no tabs"],["Nothing"]);
      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>
  </body>

</html>

번호 제목 닉네임 등록일 조회 추천
Selected marker-tabbed 첨부 파일
cyber
2007-11-30 16302 12
31 marker-manager 첨부 파일
cyber
2007-11-30 17892 20
30 marker-maptips3 첨부 파일
cyber
2007-11-30 17692 3
29 marker-maptips2 첨부 파일
cyber
2007-11-30 14723 9
28 marker-maptips 첨부 파일
cyber
2007-11-30 19926 6
27 marker-window 첨부 파일
cyber
2007-11-30 16860 16
26 marker-3exp 첨부 파일
cyber
2007-11-30 17493 16
25 markermanager-googleoffices 첨부 파일
cyber
2007-11-30 14926 11
24 markermanager-weathermap 첨부 파일
cyber
2007-11-30 18172 11
23 icon-geicons 첨부 파일
cyber
2007-11-30 18018 20
Tag List