[OpenLayers-Users] How to transfer parameters in marker click event?

Christopher Schmidt crschmidt at metacarta.com
Tue Oct 16 08:16:15 EDT 2007


On Tue, Oct 16, 2007 at 05:00:03PM +0800, Yang Zhaohui wrote:
> Hello dear sir,
> I have a question to consult you.Referencing to the example of adding
> a Marker with an AnchoredBubble popup,I implete a demo. I use WFS to
> query some data.And I make the popup display the data.It needs to
> transfer  some parameters.But when I change the function registerd on
> the marker,
> It returns wrong.The codes are as follows.What I change is that
> "marker.events.register("mousedown", marker, mousedown(evt,str));".

The third argument to 'register' is a function -- you can not pass
parameters to it. The second argument is an object -- if you want to
pass a string, you should probably make the second parameter:

 { 'marker': marker, 'string': str }

Then in mousedown, you can reference:
   this.marker
   this.string

To get the data back out.   

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list