[Typo3] OT: JavaScript depends on Doctype?

Heiner Lamprecht heiner at heiner-lamprecht.net
Fri Sep 23 11:35:38 CEST 2005


Hi everybody,

I know, that this is a bit off-topic, but I hope, nobody
complains ;-)  I post this question, because I hope, that there are
some HTML/JS experts out there on this list.

I'm developing a webapplication that uses a bit JavaScript.  Now I
discovered a somehow strange problem.

There are two JS-functions:

-------------------------------------------------------------------
function MarkItem(xPos, yPos)
{
  document.getElementById("marker").style.marginLeft = xPos - 5;
  document.getElementById("marker").style.marginTop = yPos - 5;
  document.getElementById("marker").style.display = "block";
}

function HideMarker()
{
  document.getElementById("marker").style.display = "none";
}
-------------------------------------------------------------------

"marker" is a small image.  I have a list of links like the
following (with different positions, of course):

-------------------------------------------------------------------
<a href="#"
  onmouseover="this.blur(); MarkItem(62,80); return false;"
  onmouseout="this.blur(); HideMarker(); return false;">Item</a>
-------------------------------------------------------------------

Okay, everything works fine, in Konqueror, Firefox, Opera and IE. 
The problem occurres, when the webpage starts with:

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

If so, only IE is able to move the marker to the correct position.
All other browsers show and hide the marker, but at the position
the images is set to per default.  When I remove the line, all do as
they are supposed to do.

Can anybody give me a hint what's going wrong?  Is there a solution?
I would like to have the doctype at thestart of the pages.


Thank you very much,


    Heiner

-- 
    heiner at heiner-lamprecht dot net    GnuPG - Key: 9859E373
  Fingerprint:  3770 7947 F917 94EF 8717 BADB 0139 7554 9859 E373



More information about the TYPO3-english mailing list