On Oct 15, 3:25 pm, Anil <[EMAIL PROTECTED]> wrote:
> I have the same scenario to center the map on the marker and im facing
> the same prob. The marker is not getting centered, and the most weird
> thing is that the marker is placed on the left corner of the map. here
> is the peice of code i have written.
> <td><div id="map" style="width: 300px; height: 200px"></div>
>                                     <script type="text/javascript">
>                                       var map = new
> GMap(document.getElementById("map"));
>                                          map.checkResize();
>                                          map.setCenter(new
> GLatLng(17.502030, 78.382801), 13);
>                                         var marker = new GMarker(new
> GLatLng(17.502030, 78.382801));
>                                        map.addOverlay(marker);
>                                   </script></td>
>
> More over the same code is NOT working for FireFox too.

Have you looked through the Group postings on this issue? It's been
covered hundreds of times.

Preferably, your Javascript should never appear inside a table.

If you HAVE to do that (why?) then use the {size} option when you
create your map:
  var map = new GMap(document.getElementById("map"),{size:new
GSize(300,200));

IE only sorts out the size of tables when it reaches </table>. Until
that point, ALL elements in the table, including your map div, have
zero size. So the API plots a map with zero size and centres it. Then
the browser expands the map when it reaches </table> but it's not
recentred: the centre is still at (0,0) in the top-left-hand corner.

Your map.checkResize() is executed before </table> and at that point
the map still has a size of (0,0).

Andrew
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to