Hi ulao,

where did you define the variable 'layer' used in

map.addLayer(layer);


?

Regards,
marc

Am 02.08.2010 18:01, schrieb ulao:
> I tried to make a simple app and now I have a strange issue. See the alert.
> The strange thing is this code works in the live example so it must be a
> typeO or html error I can not spot.
>
> <html xmlns="http://www.w3.org/1999/xhtml";>
>      <head>
>          <title>test</title>
>          <script src="OpenLayers.js"></script>
>          <script type="text/javascript">
>               document.write('<script type="text/javascript"
> src="http://maps.Google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTS6gjckBmeABOGXIUiOiZObZESPg";></scr'
> + 'ipt>');
>               
>              var map,glayer,lineLayer;
>
>                       function init(){
>                  map = new OpenLayers.Map('map');
>                               glayer =  new OpenLayers.Layer.Google(  "Google 
> Streets" ,      {type:
> G_NORMAL_MAP ,numZoomLevels: 22 });
>                               map.addLayer(glayer);
>                  map.addLayer(layer);alert("ie wont get here, ff does? Even
> though ff does it still didnt create the layer right");
>                               var points = new Array(new 
> OpenLayers.Geometry.Point(17.99,59.3) )
>                               points[1] = new OpenLayers.Geometry.Point(1,1)
>                               points[2] = new 
> OpenLayers.Geometry.Point(100,100)
>                               var obj = new 
> OpenLayers.Geometry.LineString(points);
>                               var newFeature = new OpenLayers.Feature.Vector( 
> obj );
>
>                               newFeature.style =
>                               {
>                                        strokeWidth: 14,
>                                        label: "test",
>                                        fontColor: "green",
>                                        fontSize: "20px",
>                                        fontFamily: "Arial",
>                                        labelAlign: "cb",
>                                        fillOpacity: 1
>                               };
>                               lineLayer.addFeatures(newFeature)
>                               map.setCenter(new OpenLayers.LonLat(17.99,59.3) 
> );
>                               //map.zoomTo(10);
>                               }
>          </script>
>      </head>
>      <body onload="init()">
>          <div id="map" class="smallmap"></div>
>      </body>
> </html>
>
>
>    

_______________________________________________
Users mailing list
Users@openlayers.org
http://openlayers.org/mailman/listinfo/users

Reply via email to