<div class="gmail_quote">
2010/5/25 Frank Broniewski <span dir="ltr">&lt;<a href="mailto:brfr@metrico.lu">brfr@metrico.lu</a>&gt;</span><br>Hi,<br>
<br>well obviously you can&#39;t pass any arguments to an event function
(in IE). The function only has access to window.event. You can do<br>
<br>
function coords(event) {<br>
                var xy = event.object.<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">getLonLatFromViewPortPx(event.xy);<br>
                var x = xy.lon;<br>
                var y = xy.lat;<br>
                ...<br>
}</blockquote><br><br>Thank you Frank, that did it, works both with Firefox and IE.<br><br>Note though that the listener has to be registered the way you indicated, not how I had tried initially. Full code below.<br><br>
Thanks,<br><br>Luís<br><br>&lt;html&gt;<br>  &lt;head&gt;<br>    &lt;title&gt;OpenLayers Demo&lt;/title&gt;<br>    &lt;style type=&quot;text/css&quot;&gt;<br>      html, body, #basicMap {<br>          width: 400px;<br>          height: 300px;<br>
          margin: 0;<br>      }<br>    &lt;/style&gt;<br>    &lt;!--&lt;script src=&quot;<a href="http://www.openlayers.org/api/OpenLayers.js">http://www.openlayers.org/api/OpenLayers.js</a>&quot;&gt;&lt;/script&gt;--&gt;<br>
    &lt;script src=&quot;../openlayers/OpenLayers.js&quot;&gt;&lt;/script&gt;<br>    &lt;script src=&#39;<a href="http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ">http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ</a>&#39;&gt;&lt;/script&gt;<br>
    &lt;script&gt;<br>      function init() {<br>        map = new OpenLayers.Map(&quot;basicMap&quot;);<br>        var gphy = new OpenLayers.Layer.Google(<br>                &quot;Google Physical&quot;,<br>                {type: G_PHYSICAL_MAP}<br>
            );        <br>        map.addLayer(gphy);<br>        map.zoomToMaxExtent();<br>        map.events.register(&quot;click&quot;, map, showCoords);<br>      }<br>      <br>      function showCoords(e)<br>      {<br>
        var xy = e.object.getLonLatFromViewPortPx(e.xy);<br>        window.alert(xy.lon + &quot; &quot; + xy.lat);<br>      }<br>    &lt;/script&gt;<br>  &lt;/head&gt;<br>  &lt;body onload=&quot;init();&quot;&gt;<br>    &lt;div id=&quot;basicMap&quot;&gt;&lt;/div&gt;<br>
  &lt;/body&gt;<br>&lt;/html&gt;<br></div>