title: javascript function does not work when used <!DOCTYPE html>
body: <p>Given the following code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function move()
  {
      dom = document.getElementById('image');
      dom.style.top=event.clientY+"px";
      dom.style.left=event.clientX+"px";
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
   &lt;html&gt;
   &lt;head&gt;
    &lt;title&gt;Program 3&lt;/title&gt;
    &lt;script type="text/javascript" src="pr3.js"&gt;&lt;/script&gt;
   &lt;/head&gt;
   &lt;body onmousedown="move();"&gt;
    &lt;img src="image.jpg" id="image" width="300px" height="200px" style="position:absolute; left:100px; top:100px;"/&gt;
   &lt;/body&gt;
   &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>Edit</strong></p>
  
  <p>The image only moves when clicked on the image. But when clicked outside the image, it does not move. </p>
  
  <p>However, without <code>&lt;!DOCTYPE html&gt;</code>, it moves wherever clicked inside the browser window and not explicitly on the image.</p>