[Typo3] OT: JavaScript depends on Doctype?
Peter Klein
peter at umloud.dk
Sat Sep 24 22:53:01 CEST 2005
Hi Heiner. It's because you need to prefix the positions with a unittype,
like "px".
Change:
document.getElementById("marker").style.marginLeft = xPos - 5;
document.getElementById("marker").style.marginTop = yPos - 5;
Into:
document.getElementById("marker").style.marginLeft = (xPos - 5)+"px";
document.getElementById("marker").style.marginTop = (yPos - 5)+"px";
---
Peter Klein /Umloud Untd.
"Heiner Lamprecht" <heiner at heiner-lamprecht.net> wrote in message
news:mailman.1555.1127468120.28241.typo3-english at lists.netfielders.de...
> 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">
> -------------------------------------------------------------------
>
> 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.
More information about the TYPO3-english
mailing list