Custom HTML pushpin Not firing any Infobox event in the brower firefox chrome and safari. RRS feed

  • Question

  • <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
          <title>Add pushpin with options</title>
          <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
          <script type="text/javascript" src="</script">"></script>
          <script type="text/javascript">
           var map = null;
           function getMap()
            map = new Microsoft.Maps.Map(document.getElementById('myMap'), { credentials: 'key' });
           function addCustomPushpin()
            var pushpinOptions = { width: null, height: null, htmlContent: "<div style='font-size:12px;font-weight:bold;border:solid 2px;background-color:LightBlue;width:100px;'>Custom Pushpin</div>" };
            var pushpin = new Microsoft.Maps.Pushpin(map.getCenter(), pushpinOptions);
            pushpinLayer = new Microsoft.Maps.EntityCollection();
            Microsoft.Maps.Events.addHandler(pushpin, 'click', test);
           function test()
            alert("Custom HTML Pushpin.");
       <body onload="getMap();">
          <div id='myMap' style="; width:400px; height:400px;"></div>
             <input type="button" value="AddCustomPushpin" onclick="addCustomPushpin();" />

    I push the pushpin to EntityCollection,the click event can't fire.

    I push the pushpin to map,the click event can work well.

    I test in the brower firefox,chrome and safari.

    Tuesday, June 18, 2013 6:53 AM


All replies