[OpenLayers-Users] PopUp is not show

Ed Boesenberg boesiii at yahoo.com
Wed Apr 10 07:36:15 PDT 2013


Phil,
I was using the javscript console in Chrome and no I am not seeing errors
about map.addPopup. I have not declared map as a local variable, see my code
below:

var map;

function init(){
map = new OpenLayers.Map('map',{
	projection: new OpenLayers.Projection('EPSG:900913'),
	displayProjection: new OpenLayers.Projection("EPSG:4326")
	});


-----Original Message-----
From: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] On Behalf Of Phil Scadden
Sent: Tuesday, April 09, 2013 11:23 PM
To: openlayers-users at lists.osgeo.org
Subject: Re: [OpenLayers-Users] PopUp is not show

In the mail list, the code was not distributed (I am guessing mail clients
didnt like the script tag) but saw it on nabble. This reinforces my point.
If you used firebug or developer console, you would have seen console errors
about map.addPopup as unknown method. If you then looked at map variable in
the debugger you would see it is a dom item. The issue in the code is that
in the init() function you have declared map as a local variable ( var map =
etc) This variable is thus out of scope for the onSelect function.
Remove the "var" off the map declaration, or better (IMHO) you can var map;
function init() ..
   map = OpenLayers.map etc
...

Get used to using the debugging tools.

Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.

_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users



More information about the Users mailing list