VEMap.HideInfoBox Method

You are not viewing the latest version of the AJAX control. Bing Maps AJAX V7 is the recommended JavaScript control for Bing Maps. If you need this documentation, it is available in as a CHM or PDF download.

Hides a shape's custom or default info box.

VEMap.HideInfoBox();

Remarks

There can be only one info box on the screen at a given time. The method will hide any currently visible info box. You do not need to specify a specific VEShape Class object in this method.

Example

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title></title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

      <script type="text/javascript" src="https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script>

      <script type="text/javascript">
         var map = null;
         var shape;
         var latLong = null;
            
         function GetMap()
         {
            map = new VEMap('myMap');
            map.LoadMap();

            latLong = map.GetCenter();

            //Add a pushpin to the map
            shape = new VEShape(VEShapeType.Pushpin, latLong);
            shape.SetTitle('<H1>Title</H1>');
            shape.SetDescription('<div style="width: 200px; background-color: white; color: blue">' +
               'This is a pushpin. It is located at <b>' + 
               latLong + '</b>. Note that custom HTML can be used.</div>');
            map.ClearInfoBoxStyles();
            map.AddShape(shape);         
         }
      
         function ShowInfoBox()
         {
            map.ShowInfoBox(shape);
         }
      
         function HideInfoBox()
         {
            map.HideInfoBox();
         }
      
         function ShowInfoBoxAt()
         {
            var x = parseInt(document.getElementById('txtMapX').value);
            var y = parseInt(document.getElementById('txtMapY').value);

            map.HideInfoBox();

            if (!isNaN(x) && !isNaN(y))
            {
               map.ShowInfoBox(shape, new VEPixel(x,y));
            }
         }
      </script>
   </head>
   <body onload="GetMap();">
      <div id='myMap' style="position:relative; width:400px; height:400px;"></div>
      <div>Click on the buttons below to show/hide the info box.</div>
      <div>
         <input value='Show info box' type='button' onclick='ShowInfoBox();'/>
         <input value='Hide info box' type='button' onclick='HideInfoBox();'/>      
      </div>
      <div>
         x:<input id='txtMapX' style='width: 30px' type='text' value='0'' />
         y:<input id='txtMapY' style='width: 30px' type='text' value='0'' />
         <input value='Show info box: x & y' type='button' onclick='ShowInfoBoxAt();'/>      
      </div>
   </body>
</html>