我有从netbean生成的以下代码,以及从这个link生成的一些修改。代码在删除后运行良好,而不是与之一起运行。可能的问题是什么?<!DOCTYPE html>
<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
**<!DOCTYPE html>**
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>OpenLayers Example</title>
<script src="http://openlayers.org/api/OpenLayers.js"></script>
</h:head>
<body>
<div style="width:100%; height:100%" id="map"></div>
<script defer="defer" type="text/javascript">
var map = new OpenLayers.Map('map');
var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'} );
var dm_wms = new OpenLayers.Layer.WMS(
"Canadian Data",
"http://www2.dmsolutions.ca/cgi-bin/mswms_gmap",
{
layers: "bathymetry,land_fn,park,drain_fn,drainage," +
"prov_bound,fedlimit,rail,road,popplace",
transparent: "true",
format: "image/png"
},
{isBaseLayer: false}
);
map.addLayers([wms, dm_wms]);
map.zoomToMaxExtent();
</script>
</body>
</html>
发布于 2012-05-02 12:57:23
无论是您正在使用的应用程序接口,还是您使用它的方式,都依赖于浏览器中的Quirks Mode (即,一种浏览器故意偏离标准和规范的模式,以模拟老的有buggy的浏览器)。
顺便说一句,与模式无关,Firefox会报告以下错误:
document.getElementsByTagName("head")[0] is undefined
Source: http://openlayers.org/api/OpenLayers.js
Line: 424
此外,页面在两种模式下都显示为空。这就是你所说的“行不通”吗?
https://stackoverflow.com/questions/10407595
复制相似问题