Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] mozilla & doctype Bug


  • From: rer at datacompusa.com (Roger Roelofs)
  • Subject: [Javascript] mozilla & doctype Bug
  • Date: Wed Aug 24 08:44:28 2005

Laurent,

On Aug 24, 2005, at 8:38 AM, Laurent Muchacho wrote:

> javascript:
> document.getElementById('myDiv').style.width = '100';
>
> Usually this work fine crossbrowser in my code when I don't use any  
> doctype but soon as I place a doctype in my html code firefox stop  
> working

The reason this is true is that without a doctype (and with older  
ones like html 3.2) the firefox is in 'quirks' mode.  This mode has  
many hacks in it to support non-standard coding practices.  When you  
add a html 4.01 or xhtml doctype, firefox switches to 'standards' (or  
'almost-standards') mode where the dom will be more strict about what  
code it will accept.  So, change to

document.getElementById('myDiv').style.width = '100px';

hth

Roger
-------------------------------------------------------
Roger Roelofs                          web   www.datacompusa.com
Datacomp Appraisal Services   Email rer@xxxxxxxxxxxxxxx
3215 Eaglecrest Drive, NE
Grand Rapids, MI  49525-4593