Activate Pin popup when you add the pin

This Page is locked
Modified: 2007/10/07 10:02 by ViaVE Visitor
By using the combination of the pin ID and the unique map ID you can get access to the underlying html div element and call the mouseover.


<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <title></title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
      <script src="http://dev.virtualearth.net/mapcontrol/v4/mapcontrol.js" type="text/javascript"></script>
      <script type="text/javascript">
         var map = null;
         var pinID = 1;
         
         function GetMap()
         {
            map = new VEMap('myMap');
            map.LoadMap();
         }   
         
         function AddPin()
         {   
            var pin = new VEPushpin(
               pinID, 
               map.GetCenter(), 
               null, 
               'My pushpin', 
               'This is pushpin number '+pinID
               );
            map.AddPushpin(pin);
            document.getElementById(pinID + "_" + map.GUID).onmouseover();
            pinID++;
         }        
      </script>
   </head>
   <body onload="GetMap();">
      <div id='myMap' style="position:relative; width:400px; height:400px;"></div>
      <a href="#" onclick="AddPin();">Add a pushpin to the center of the map</a>
   </body>
</html>