# Javascript and DTD?

**URL:** <https://forum.kirupa.com/t/javascript-and-dtd/235008>\
**Category:** Uncategorized\
**Created:** [August 7, 2007, 7:03pm UTC](https://forum.kirupa.com/t/javascript-and-dtd/235008 "2007-08-07T19:03:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![newsteve](https://avatars.discourse-cdn.com/v4/letter/n/5f8ce5/32.png) [@newsteve](https://forum.kirupa.com/u/newsteve)\
**Post date:** [August 7, 2007, 7:03pm UTC](https://forum.kirupa.com/t/javascript-and-dtd/235008/1 "2007-08-07T19:03:50Z")

</div>

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](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](http://www.stevenewberry.com/experimental/index2.html)

any insight would be awesome!
