[OpenLayers-Users] IE weirdness

Christopher Schmidt crschmidt at metacarta.com
Wed Mar 21 10:26:39 EDT 2007


On Wed, Mar 21, 2007 at 03:21:37PM +0100, Eric Lemoine wrote:
> Hi list
> 
> I've experienced weird things with OL in IE (version 7).
> 
> The following examples are all based on examples/lite.html.
> 
> This works:
> 
> <body onload="init()">
> <table><tr><td>
>   <div id="map"></div>
> </td></tr></table>
> </body>
> 
> This works:
> 
> <body>
> <div id="map"></div>
> <script type="text/javascript">
>   <!--
>   init();
>   // -->
> </script>
> </body>
> 
> This does NOT work:
> 
> <body>
> <table><tr><td>
> <div id="map"></div>
> <script type="text/javascript">
>   <!--
>   init();
>   // -->
> </script>
> </td></tr></table>
> </body>

When you say 'does not work': can you be more specific? is it that the
map doens't display correctly, or is it that there is a Javascript error?

I never put the script anywhere but the <head> of the page because there
are plenty of issues doing anything else. In this case, your init() is
probably being called before the end of the table has had a chance to
load, and as a result, the map has no width/height when it's
initialized, and thus it doesn't show up correctly after initializing.

Is there a specific reason you need to do it hte way you are?

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list