I could be that your html and body tag doesn't have a heigh and with. 

So 100% of 0 is 0. Set in your css:

html, body { height: 100%; with: 100%}

probably the reason it works when you copy the code is that then the elements 
exists on the page on render.

You could also try changing 100% to a number in px.

..fredrik



On 15 jun 2010, at 12.16, SamMP wrote:

> I am using the simple code below to display a map. For some reason it
> is not displaying anything. When I do view generated source I can see
> the rendered map. If I copy that source in an html file. I can see the
> map. What is wrong?
> 
> <?xml version="1.0" encoding="UTF-8" ?>
> <%@ page language="java" contentType="text/html; charset=UTF-8"
> pageEncoding="UTF-8"%>
> <%
>       double latitude = 33.65;
>       double longitude =-84.43333333333334;
> %>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
> www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en">
> <head>
>       <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /
>> 
>       <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
>       <meta http-equiv="Pragma" content="no-cache"/>
>       <meta http-equiv="Expires" content="-1"/>
>       <meta name="description" content=""/>
>       <title></title>
>       <script type="text/javascript" src="http://maps.google.com/maps/api/
> js?sensor=false" />
>       <script type="text/javascript">
>               var latitude = parseFloat('<%=latitude%>');
>               var longitude = parseFloat('<%=longitude%>');
>               function initialize() {
>                       var center = new google.maps.LatLng(latitude,longitude);
>                       var mapOptions = {
>                                       zoom: 5,
>                                       center: center,
>                                       mapTypeId: google.maps.MapTypeId.ROADMAP
>                   };
>                   var map = new
> google.maps.Map(document.getElementById("map_canvas"), mapOptions);
>               }
>       </script>
> </head>
> <body onload="initialize()";>
>       <div id="map_canvas" style="width:100%; height:100%"></div>
> </body>
> </html>
> 
> Thanks Sam.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Google Maps JavaScript API v3" 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-js-api-v3?hl=en.
> 

--
Fredrik Bonander
[email protected]
+46 70 943 5441

- the infinite power of the creative mind - 

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.

Reply via email to