[Javascript] DOCTYPE making div.style.top NOT WORK

David Dorward david at dorward.me.uk
Thu Dec 14 06:51:13 CST 2006


On Thu, Dec 14, 2006 at 01:49:34PM +0100, Michael Borchers wrote:
> the following script works fine so far!
> but when adding the following DOCTYPE into the first line:
> 
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

This triggers Standards mode and turns off a number of bugs in a
number of browsers (not that XHTML is a good choice due to browser
support, now Transitional (due to it being Strict + legacy junk you
should not use)..
 
> the script stops working and div.style.top seems to have no effect.
>    div.style.top  = a.x+58;
>    div.style.left = a.y+20;

The top and left properties take lengths, not integers. Lengths
(except 0) require units.

-- 
David Dorward                                      http://dorward.me.uk




More information about the Javascript mailing list