You are here: xhtml style.left problem « HTML « IT news, forums, messages
xhtml style.left problem

Posted by carex on 11/20/07 12:22

Hello,

Since a few weeks I am trying to use xhtml i.s.o html everywhere in my web
application

But, for the first time, I have something that is working perfectly with
IE6 but not in Firefox when I use a DOCTYPE

Here below the code:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>offset</title>
<script type="text/javascript">
//<![CDATA[
var delta=3;
function move(){
var y=document.getElementById("myDiv").offsetLeft;
if (y > screen.width - document.getElementById("myDiv").offsetWidth) {
delta=-3;
}
if (y < 0) {
delta=3;
}
y+=delta;
document.getElementById("myDiv").style.left=y;
document.getElementById("pos").innerHTML=y;
setTimeout("move()",30);
}
//]]>
</script>
</head>
<body onload="alert(document.compatMode);javascript:move()">
<div id="myDiv" style="position:absolute; left:50px; top:100px; width:200px; height:50px; background-color:blue;">
<h4>That's it damnit !!!(<span id="pos">pos</span>)</h4>
</div>
</body>
</html>


In Firefox, altough there is no error detected, the position is not
updated.
But if I remove the DOCTYPE then it works.

Is it a problem with Firefox ????

Thanks.
carex.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация