Javascript and DTD?

hi,

im fairly new to javascript.

im designing a web page that gives random background colors to some divs. everything works great until i put a DTD (document type definition) at the top of my code. im looking for reasons as to why this is…? I would like to use the DTD to avoid other problems (like quirks mode IE6 etc…)

my page (as I want it to look - without the DTD) can be found at:
http://www.stevenewberry.com/experimental/index3.html

my page (with the correct DTD - but it wont display coloured divs) is at:
http://www.stevenewberry.com/experimental/index2.html

any insight would be awesome!