[OpenLayers-Users] Mouseposition div

Andy Dale andy.dale at gmail.com
Tue Mar 11 09:17:21 EDT 2008


Hi Steven,

Thanks for the help, it now works :-)

Cheers,

Andy

On 11/03/2008, Stephen Woodbridge <woodbri at swoodbridge.com> wrote:
>
> Andy Dale wrote:
> > Hi,
> >
> > I have an extracted all the javascript that is used for displaying the
> > map into a separate .js file.  This works very well, the only problem
> > being that, I cannot figure out how to set the mouseposition control to
> > be in a separate div.  I initialize the control like so:
> >
> > map.addControl(new OpenLayers.Control.MousePosition({element:
> $('mydiv')}));
> >
> > where mydiv will exist on every page i use the map on.  As an experiment
> > i include all the JavaScript contained within the external javascript in
> > head section, and the MousePosition is displayed in the correct div.
> >
> > Is there a way to set the div for the mouse position if you are
> > including the javascript to display the map as an external file ??
>
>
> Andy,
>
> Create an initialize function that executes your map initialization and
> put the in your external file. Then
>
> <body onLoad=myInitialize()>
>
> The problem you are having in that 'mydiv' has not been created in the
> DOM yet when you execute the map.addControl... command above, but it
> will be when the onLoad event is fired.
>
> -Steve W
>   http://imaptools.com/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080311/c0807673/attachment.html


More information about the Users mailing list