[OpenLayers-Users] DOCTYPE causes scripts to fail

Gary Townsend garyt at spatialmapping.com
Fri Feb 9 15:30:32 EST 2007


Yes you're right my apologies I hit send before thinking my request full
through.

The errors I get vary on the browser in fire fox I get:

Error: this.position has no properties
Source File: http://localhost/lib/OpenLayers/Tile.js
Line: 103

IE 6 I get 
Line: 66
Error: this.tile is null or not an object

If I hit no to debug I then get

Line: 413
Error: Number Expected

I hadn't tried it in any other browsers.

These are the Doctype declarations I have tried it with.

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd"

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"


The Javascript:
<script src="/lib/OpenLayers.js"></script>
<scripttype="text/JavaScript">
function init(){
		var map = new OpenLayers.Map('map',
{'maxResolution':'auto'});
		var ol_wms = new OpenLayers.Layer.WMS.Untiled(
"Globe","http://www.resmap.com/resmapserver/mapserv.exe?map=C:/Inetpub/Resma
pRoot/ResmapSearch.map", {layers: 'Globe', format: 'jpeg'},{ratio:1} );
		var pb_wms = new
OpenLayers.Layer.WMS.Untiled("Borders","http://www.resmap.com/resmapserver/m
apserv.exe?map=C:/Inetpub/resmaproot/ResmapSearch.map", {layers:
'PoliticalBoundaries',format: 'gif', transparent:'true'} );

		map.addLayers([ol_wms,pb_wms]);
		map.addControl(new OpenLayers.Control.LayerSwitcher());
		map.setCenter(new OpenLayers.LonLat(0, 0),0);
		map.events.register("zoomend",map,function(e){
		var mapBounds = new OpenLayers.Bounds();
		mapBounds = map.getExtent();
		document.forms[0].txtMinX.value = mapBounds.left;
		document.forms[0].txtMinY.value = mapBounds.bottom;
		document.forms[0].txtMaxX.value = mapBounds.right;
		document.forms[0].txtMaxY.value = mapBounds.top;
		});
		map.events.register("moveend",map,function(e){
		var mapBounds = new OpenLayers.Bounds();
		mapBounds = map.getExtent();
		document.forms[0].txtMinX.value = mapBounds.left;
		document.forms[0].txtMinY.value = mapBounds.bottom;
		document.forms[0].txtMaxX.value = mapBounds.right;
		document.forms[0].txtMaxY.value = mapBounds.top;
});
</script>

-----Original Message-----
From: Christopher Schmidt [mailto:crschmidt at metacarta.com] 
Sent: February 9, 2007 11:45 AM
To: Gary Townsend
Cc: users at openlayers.org
Subject: Re: [OpenLayers-Users] DOCTYPE causes scripts to fail

On Fri, Feb 09, 2007 at 10:17:56AM -0800, Gary Townsend wrote:
> I have a page that with no doctype declared in the html the map displays
> just fun but when the designers apply their templates OpenLayers starts
> returning errors. I saw the XHTML patch through google but was unsure a)if
> that would affect my problem since this is affecting even HTML Doctypes b)
> how I would apply it if it did fix my problem.

1. Are you using the single file build, or the developement
   automatic script-include builds?

2. Something more specific than 'starts returning errors' is neccesary
   here. Starting from an example and showing the smallest number of
   changes to cause an error is most beneficial, but if you can't do
   that, an example HTML page, or even an error message that you get,
   would be helpful in resolving problems.  

Regards,
-- 
Christopher Schmidt
MetaCarta




More information about the Users mailing list