Urgent: Help with onclick on a icon and display InfoWindow with multiple tabs

440
0
03-26-2011 03:10 AM
Sophialim
New Contributor
hi i am a new beginner, i am currently doing a project and cant figure out how to code with onclick on a icon and display InfoWindow with multiple tabs through hard code way

I have saw that this sample link http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/find_drilldown... but i am not able to put those code onto my code

Below is my code, i can put icon and Infowindow with hard code data but i wasn't able to put in the multiple tab in:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"

"http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;

charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<!--<meta http-equiv="refresh" content="300">--

><title>PUB</title>
<script type='text/JavaScript'

src='http://www.onemap.sg/API/JS?accessKEY=qo/s2TnSUmfLz+32CvLC4RMVkzEFYjxqytiKhByvEacEdMWBpCuSSQ+IFRT84Q...''></script>

  <script type="text/javascript">
        dojo.require("esri.map");
        dojo.require("esri.tasks.geometry");
        dojo.require("esri.dijit.InfoWindow");

        var map=null;
        var topoMap=null;
        var levelNumber=1;
        var centerPoint="32173.834393929,29296.8452311538";
        var OneMap = new GetOneMap('map','SM',{level:levelNumber,center:centerPoint});
        function initialize() {
       
            map=OneMap.map;
            //handle map object here
            if( map ==null  )
            {
                LogError("map not initialized");return;
            }
            //dojo.connect(map, "onLoad", PlaceLabel);
            PlaceLabel();
                }

      function PlaceLabel(evt,element) {
      map.graphics.clear();
        var strImage,symbol,pt,graphic,json,stX,stY,contentVar,contentVar1,contentVar2,infoTemplate,g,tit;
        var icounter = 0;

stX             =   "26466.5635173511";
stY             =   "30492.6648446557";
tit ="TRY OUT"
contentVar2 = "Wad so ever"
pt= new esri.geometry.Point(stX,stY,map.spatialReference); 
contentVar1 = "Description: " + contentVar2

strImage = "C:/Users/Sophia/Desktop/icon.jpg";

symbol = new esri.symbol.PictureMarkerSymbol(strImage, 25,25);
contentVar = contentVar1 ;
json= {title:tit,content:contentVar};

infoTemplate = new esri.InfoTemplate(json);

graphic = new esri.Graphic(pt,symbol);
graphic.setInfoTemplate(infoTemplate);

map.graphics.add(graphic);

dojo.connect(graphic, "onClick", function(evt) { 

g = evt.graphic;
map.infoWindow.setTitle();
map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint));
map.infoWindow.resize(260,130);
}); 
}
dojo.addOnLoad(initialize);
    </script>

</head>
<body class="tundra">

<table>
        <tr>
            <td width="2px">
                         </td>
            <td>
                <div id="map" style="width:530px;
height:500px; border:1px solid #000;"></div>
                      </td>
            <td width="2px">
                 
            </td>
        </tr>
        <tr>
            <td width="2px">
                 
            </td>                  
            <td width="2px">
            </td>
</tr> 
    </table>
</body>
</html>

Please Help me and Reply ASAP!
Thanks!
0 Kudos
0 Replies