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.


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.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

      <script type="text/javascript" src=""></script>

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

            latLong = map.GetCenter();

            //Add a pushpin to the map
            shape = new VEShape(VEShapeType.Pushpin, latLong);
            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>');
         function ShowInfoBox()
         function HideInfoBox()
         function ShowInfoBoxAt()
            var x = parseInt(document.getElementById('txtMapX').value);
            var y = parseInt(document.getElementById('txtMapY').value);


            if (!isNaN(x) && !isNaN(y))
               map.ShowInfoBox(shape, new VEPixel(x,y));
   <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>
         <input value='Show info box' type='button' onclick='ShowInfoBox();'/>
         <input value='Hide info box' type='button' onclick='HideInfoBox();'/>      
         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();'/>