[OpenLayers-Users] Firebug and OL

Christopher Schmidt crschmidt at metacarta.com
Wed Dec 10 18:44:02 EST 2008


On Wed, Dec 10, 2008 at 03:30:47PM -0800, Jay Douillard wrote:
> I've been having trouble debug my openlayers code with firebug. I thought I was doing something fundamentally wrong, but then I checked the demo map on the openlayers homepage and the same code that did not work with my map worked just fine..
> for example 
> >>map.layers.length
> should = a number in this case 2
> All I get is :
> 
> ReferenceError: map is not defined
> 
> which references line 65 :     units: 'm',
> 
> 
> Any ideas why map is not defined? I'm sure it is a small javascript mistake on my part!

Scope.

'var' means 'make this a local variable. Unless you're at a breakpoint,
Firebug works in the global scope. Dropping 'var' in front of your 'map'
variable will let you interact with it in Firebug.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list