Hi Steven,<br><br>Thanks for the help, it now works :-)<br><br>Cheers,<br><br>Andy<br><br><div><span class="gmail_quote">On 11/03/2008, <b class="gmail_sendername">Stephen Woodbridge</b> <<a href="mailto:woodbri@swoodbridge.com">woodbri@swoodbridge.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Andy Dale wrote:<br> > Hi,<br> ><br> > I have an extracted all the javascript that is used for displaying the<br> > map into a separate .js file. This works very well, the only problem<br> > being that, I cannot figure out how to set the mouseposition control to<br>
> be in a separate div. I initialize the control like so:<br> ><br> > map.addControl(new OpenLayers.Control.MousePosition({element: $('mydiv')}));<br> ><br> > where mydiv will exist on every page i use the map on. As an experiment<br>
> i include all the JavaScript contained within the external javascript in<br> > head section, and the MousePosition is displayed in the correct div.<br> ><br> > Is there a way to set the div for the mouse position if you are<br>
> including the javascript to display the map as an external file ??<br> <br> <br>Andy,<br> <br> Create an initialize function that executes your map initialization and<br> put the in your external file. Then<br> <br>
<body onLoad=myInitialize()><br> <br> The problem you are having in that 'mydiv' has not been created in the<br> DOM yet when you execute the map.addControl... command above, but it<br> will be when the onLoad event is fired.<br>
<br> -Steve W<br> <a href="http://imaptools.com/">http://imaptools.com/</a><br> </blockquote></div><br>