I have the following script (below). If I have the DOCYPE at the top,
tDIV.style.top and tDIV.style.left don't return a value. If I remove the
DOCTYPE from the first line, it works fine and returns and manipulates the
values perfectly.
What could possibly be the relationship? Why would the inclusion of a
DOCTYPE tag at the top of a page break Javascript code?
Browser: Mozilla Firefox. (note: the DOCTYPE on my site is all on one
line, wrapped here for USENET.)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Title</title>
<link rel="stylesheet" media="screen" href="style.css" title="main"/>
<script type="text/javascript">
<!--
//<![CDATA[
function getLayer(SRC,event){
var IE = document.all?true:false;
var tempX = 0;
var tempY = 0;
var tDIV = document.getElementById(SRC);
tDIV.style.cursor = "hand";
if (IE) { // grab the x-y pos.s if browser is IE
tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
}
else { // grab the x-y pos.s if browser is NS
tempX = event.pageX;
tempY = event.pageY;
}
if (tempX < 0){tempX = 0;}
if (tempY < 0){tempY = 0;}
tDIV.style.top = (tempY - 20);
tDIV.style.left = (tempX - 20);
tDIV.style.visibility = "visible";
}
function hideLayer(SRC){
var tDIV = document.getElementById(SRC);
tDIV.style.visibility='hidden';
}
//]]>
-->
</script>
</head>
--
[ Sugapablo ]
[ http://www.sugapablo.net <--personal | http://www.sugapablo.com <--music ]
[ http://www.2ra.org <--political | http://www.subuse.net <--discuss ]