Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Many events were renamed in 7, I think you want to use "<strong>click</strong>" instead of "<em>onclick</em>" and "<strong>viewchangeend</strong>" instead of "<em>onchangeview</em>".</p> <p>Depending on what you need it for, you may prefer events "<strong>viewchangestart</strong>", "<strong>viewchange</strong>" or "<strong>targetviewchanged</strong>" however.</p> <hr> <p>Also, you should definitely use "<strong>Microsoft.Maps.Events.addHandler</strong>" to setup the listeners with 7, all events use the Events object now.</p> <hr> <p>Example:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;script src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0" type="text/javascript" charset="UTF-8"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body onload="init()"&gt; &lt;div id="map" style="position: relative; width: 800px; height: 350px;"&gt;&lt;/div&gt; &lt;script type="text/javascript"&gt; /** * Map click event handler. */ function onclick(e){ var map = this.target; //reference to the Map object from which it came //... var x = e.getX(); // horizontal position of the click var y = e.getY(); // vertical position of the click //... console.log('The map has been clicked'); } /** * View change event handler. */ function onview(){ var map = this.target; //reference to the Map object from which it came //... console.log('The view has changed'); } /** * Load the map and setup event listeners */ function init(){ var map = new Microsoft.Maps.Map( document.getElementById("map"), { credentials: "YOUR-BING-KEY", mapTypeId: Microsoft.Maps.MapTypeId.road } ); Microsoft.Maps.Events.addHandler(map, "click", onclick); Microsoft.Maps.Events.addHandler(map, "viewchangeend", onview); } &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <hr> <p>List of events (at the bottom of the page): <a href="http://msdn.microsoft.com/en-us/library/gg427609.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/gg427609.aspx</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload