[OpenLayers-Dev] =?gb2312?b?u9i4tDogID8/OiBvcGVubGF5ZXJzIHByb2Js?= =?gb2312?b?ZW0gaW4gSUU2?=

dequan chen cdqrain at gmail.com
Mon Oct 20 10:42:38 EDT 2008


hi Matthias Pohl. thanks

sorry for forgetting to mention that if you remove <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> or just
remove the segment of
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" from the
page. IE7 FF will not work too.
So, I think IE6 do not according to the W3C standard even though we
add this DOCTYPE in page.

var map = new OpenLayers.Map('map');
            var layer = new OpenLayers.Layer.WMS("OpenLayers WMS",
                    "http://labs.metacarta.com/wms/vmap0", { layers: 'basic' });
            map.addLayer(layer);
            map.addControl(new OpenLayers.Control.LayerSwitcher());

            var lineLayer1 = new OpenLayers.Layer.Vector("Line Layer");
            var pts = [];
            pts.push(new OpenLayers.Geometry.Point(0, 1));
            pts.push(new OpenLayers.Geometry.Point(12, 50));
            var line = new OpenLayers.Feature.Vector(new
OpenLayers.Geometry.LineString(pts), null,
OpenLayers.Feature.Vector.style['default']);
            lineLayer1.addFeatures([line]);
            lineLayer1.events.register("mouseover", lineLayer1, function(e) {
                this.div.style.cursor = "pointer";
                var feature = this.getFeatureFromEvent(e);
                if (feature)
                    alert("LineLayer1");
            });
            var lineLayer2 = new OpenLayers.Layer.Vector("Polygon Layer");
            var pts = [];
            pts.push(new OpenLayers.Geometry.Point(-70, -10));
            pts.push(new OpenLayers.Geometry.Point(12, 50));
            var line = new OpenLayers.Feature.Vector(new
OpenLayers.Geometry.LineString(pts), null,
OpenLayers.Feature.Vector.style['default']);
            lineLayer2.addFeatures([line]);
            lineLayer2.events.register("mouseover", lineLayer2, function(e) {
                this.div.style.cursor = "pointer";
                var feature = this.getFeatureFromEvent(e);
                if (feature)
                    alert("LineLayer2");
            });
            map.addLayer(lineLayer1);
            map.addLayer(lineLayer2);

            map.setCenter(new OpenLayers.LonLat(0, 0));

this code tests success in IE7 and FF, but not in IE6.
if i remove DOCTYPE, all of the browsers do not work. only top vector
layer event triggered.

I think, it is the core problem.

2008/10/20, Matthias Pohl <m.pohl at m-click.de>:
> @dequan chen
>
> Beside the problem with IE6 you wrote that your example will work with FF.
>
>> all of the features can be displayed normally.
>> IE7 FF do not have this issue.
>
> I tried to make your example work with FF2 and FF3, but with no success.
> Only the top vector layer can trigger the mouseover event.
>
> Can you provide a link to a working example on the web?
>
> Regards, matt
>



More information about the Dev mailing list