How do I embed Bing maps in my website pointing to a office location?

Go To StackoverFlow.com

2

How do I embed Bing maps in my website pointing to my office address with a descriptive information window?

2012-04-05 15:34
by Somdeb


1

Here is an example:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title>Infobox set location</title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
      <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>
      <script type="text/javascript">
      var map = null;

      function getMap()
      {
        map = new Microsoft.Maps.Map(document.getElementById('myMap'), {credentials: 'Your Bing Maps Key'});
      }

      function setInfoBoxLocation()
      {
        map.entities.clear();         
        var infoboxOptions = {width :200, height :100, showCloseButton: true, zIndex: 0, offset:new Microsoft.Maps.Point(10,0), showPointer: true, title:'Infobox Title', description:'Infobox description' }; 
        var defaultInfobox = new Microsoft.Maps.Infobox(map.getCenter(), infoboxOptions );    
        map.entities.push(defaultInfobox); 
        defaultInfobox.setLocation(new Microsoft.Maps.Location(47.4, -122.33));
      }
      </script>
   </head>
   <body onload="getMap();">
      <div id='myMap' style="position:relative; width:400px; height:400px;"></div>
      <div>
         <input type="button" value="SetInfoBoxLocation" onclick="setInfoBoxLocation();" />
      </div>
   </body>
</html>

Here are some more examples: http://www.bingmapsportal.com/ISDK/AjaxV7

2012-04-05 15:47
by stewe
Ads