<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Add default pushpin</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', center: new Microsoft.Maps.Location(47.609771, -122.2321543125), zoom: 8}); } function addDefaultPushpin() { var pushpin= new Microsoft.Maps.Pushpin(map.getCenter(), null); map.entities.push(pushpin); } </script> </head> <body> <div id='myMap' style="position:relative; width:400px; height:400px;"></div> <div> <input type="button" value="AddDefaultPushpin" /> </div> </body> </html> |