[OpenLayers-Users] getLonLatFromPixel in IE
Luís de Sousa
luis.a.de.sousa at gmail.com
Tue May 25 07:02:46 EDT 2010
Hello everyone,
Please check the code below. This is a very simple map with an event
listener that shows the coordinates when you click on it. It works on every
know web browser in the world, Firefox, Opera, Chrome, except for ... yes
you guessed it, Internet Explorer!
Is there any work around for this? Is it worth to dedicate time to this? Is
OpenLayers supposed to work with IE?
Thank you,
Luís
<html>
<head>
<title>OpenLayers Demo</title>
<style type="text/css">
html, body, #basicMap {
width: 400px;
height: 300px;
margin: 0;
}
</style>
<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script src='
http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ
'></script>
<script>
function init() {
map = new OpenLayers.Map("basicMap");
var gphy = new OpenLayers.Layer.Google(
"Google Physical",
{type: G_PHYSICAL_MAP}
);
map.addLayer(gphy);
map.zoomToMaxExtent();
OpenLayers.Event.observe($('basicMap'),"click",showCoords.bindAsEventListener(map));
}
function showCoords(e)
{
var LL = this.getLonLatFromPixel (e.xy);
window.alert(LL);
}
</script>
</head>
<body onload="init();">
<div id="basicMap"></div>
</body>
</html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100525/c1ab144a/attachment.html
More information about the Users
mailing list