# !DOCTYPE html confict please help!

**URL:** <https://forum.kirupa.com/t/doctype-html-confict-please-help/329309>\
**Category:** Uncategorized\
**Created:** [August 12, 2012, 2:34pm UTC](https://forum.kirupa.com/t/doctype-html-confict-please-help/329309 "2012-08-12T14:34:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![camaleon](https://avatars.discourse-cdn.com/v4/letter/c/e36b37/32.png) [@camaleon](https://forum.kirupa.com/u/camaleon)\
**Post date:** [August 12, 2012, 2:34pm UTC](https://forum.kirupa.com/t/doctype-html-confict-please-help/329309/1 "2012-08-12T14:34:29Z")

</div>

Hi guys!

I have this code for change the color of the row when clicked work fine but,  
I must add the html type on top of the page:

\<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “[http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd](http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd)”\>

\*\*when I add the Doctype the script dont work.

What can I do for fix it???\*\*

```auto

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language=javascript>

function changeColor(obj) {
   newColor = (obj.style.backgroundColor == '') ? '#DDDDDD' : '';
   rowObj = obj.parentElement;
   for (i = 0; i < rowObj.childNodes.length; i++) {
      rowObj.childNodes*.style.backgroundColor = newColor;
   }
}  

</script>
</head>
<body>

<table cellpadding=2 border=1>
   <tr>
      <td onclick='changeColor(this)'>1,1</td>
      <td onclick='changeColor(this)'>1,2</td>
      <td onclick='changeColor(this)'>1,3</td>
   </tr>
   <tr>
      <td onclick='changeColor(this)'>2,1</td>
      <td onclick='changeColor(this)'>2,2</td>
      <td onclick='changeColor(this)'>2,3</td>
   </tr>
   <tr>
      <td onclick='changeColor(this)'>3,1</td>
      <td onclick='changeColor(this)'>3,2</td>
      <td onclick='changeColor(this)'>3,3</td>
   </tr>
   <tr>
      <td onclick='changeColor(this)'>4,1</td>
      <td onclick='changeColor(this)'>4,2</td>
      <td onclick='changeColor(this)'>4,3</td>
   </tr>
</table>
</body>
</html>

```

thanks for help.
