[OpenLayers-Users] Problem showing OpenLayer controls in a page with a DOCTYPE

Ruben Pardo correosig at gmail.com
Thu Jun 28 08:04:21 EDT 2007


Hi,

I'm checking my html source generated but it doesn't work. I'm using
OpenLayers 2.4 API, and still have the same problem. When i remove the tag
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd" > it works fine.

My code  :...........

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd" >
<html >
    <head>
        <meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type">
    </head>
    <body onload="init();"  >

     <style type="text/css">
        #map {
            width: 800px;
            height: 500px;
            border: 1px solid black;
        }
           </style><script src="js/lib/OpenLayers.js"
type="text/javascript"></script> <script type="text/javascript" >
  <!--
               var map,layer;

         function init(){

           map = new OpenLayers.Map('map', { controls: [],tileSize: new
OpenLayers.Size(500,500) });
          layer = new OpenLayers.Layer.MapServer( "OpenLayers WMS","
http://192.168.212.20:84/cgi-bin/mapserv.exe?map=/ms4w/apps/prbmosaico/htdocs/prbmosaico.map",{layers:
'PARCELASDE', TRANSPARENT: 'true'},{ maxExtent: new OpenLayers.Bounds(
186555.49,4136068.22,211516.81,4156763.12), maxResolution: 104} );

           map.addControl(new OpenLayers.Control.PanZoomBar());
           map.addControl(new OpenLayers.Control.MouseToolbar());
           map.addControl(new OpenLayers.Control.OverviewMap());

           map.addLayer(layer);
                    if (!map.getCenter())
                       map.zoomToMaxExtent();


        }
        </script>

      <div style="margin:0px" id="map"></div>
</body>





2007/6/28, Christian López Espínola <penyaskito at gmail.com>:
>
> Hola Ruben,
>
> The doctype mustn't be a problem with OpenLayers. I'm using ASP.NET
> with OpenLayers and I hadn't any problem.
> Please check the HTML source generated by your application and if you
> can't find the solution, post a piece.
>
> Hope this helps
>
> On 6/28/07, Ruben Pardo <correosig at gmail.com> wrote:
> > Hi everybody,
> >
> > I've got a problem  showing controls with OpenLayers when i put a
> doctype on
> > my html page.
> > I'm integrating OpenLayers in a custom jsf component, that autogenerate
> the
> > DOCTYPE.
> > It shows me the layers, but not the controls over the layers
> (PanZoomBar,
> > Overview, etc...)
> > It works fine when i remove the doctype in the generated code.
> > ¿how can i solve this?
> >
> > Thanks a lot in advance
> >
> > My generated code is ...
> >
> > ------------------------------------------------------------------
> >
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> > "http://www.w3.org/TR/html4/loose.dtd" >-->
> > <html >
> >     <head>
> >         <meta content="text/html;charset=ISO-8859-1"
> > http-equiv="Content-Type">
> > </head><body onload="init();">
> >      <style type="text/css">
> >         #map {
> >             width: 800px;
> >             height: 500px;
> >             border: 1px solid black;
> >         }
> >            </style><script src="js/lib/OpenLayers.js"
> > type="text/javascript"></script> <script
> > type="text/javascript" >
> >   <!--
> >                var map,layer;
> >
> >          function init(){
> >
> >            map = new OpenLayers.Map('map', { controls: [],tileSize: new
> > OpenLayers.Size(500,500) });
> >           layer = new OpenLayers.Layer.MapServer( "OpenLayers
> > WMS","
> http://192.168.212.20:84/cgi-bin/mapserv.exe?map=/ms4w/apps/prbmosaico/htdocs/prbmosaico.map
> > ",{layers: 'PARCELASDE', TRANSPARENT: 'true'},{ maxExtent: new
> > OpenLayers.Bounds(186555.49,4136068.22,211516.81,4156763.12),
> maxResolution:
> > 104} );
> >
> >            map.addControl(new OpenLayers.Control.PanZoomBar());
> >            map.addControl(new OpenLayers.Control.MouseToolbar());
> >            map.addControl(new OpenLayers.Control.OverviewMap());
> >
> >            map.addLayer(layer);
> >                     if (!map.getCenter())
> >                        map.zoomToMaxExtent();
> >
> >
> >         } //-->
> >         </script>
> >
> >
> >       <div  id="map"></div>
> >        </body>
> >
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> >
> > _______________________________________________
> > Users mailing list
> > Users at openlayers.org
> > http://openlayers.org/mailman/listinfo/users
> >
> >
>
>
> --
> Regards,
>
> Christian López Espínola
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070628/fadfd23b/attachment.html


More information about the Users mailing list