title: Uncaught TypeError: Cannot read property 'pageX' of undefined on Chrome
body: <p>This is my code:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form name="mousemove"&gt;
    &lt;input type="text" name="mousex" /&gt; mouse x: &lt;br&gt;
    &lt;input type="text" name="mousey" /&gt; mouse y: &lt;br&gt;
  &lt;/form&gt;
  &lt;script type="text/javascript"&gt;
    var mie = (navigator.appname == "Microsoft Internet Explorer") ? true : false;
    if (!mie) {
      document.captureEvents(Event.MOUSEMOVE);
      document.captureEvents(Event.MOUSDOWN);
    }
  
    document.onmousemove = mousePos();
    document.onmousedown = mouseClicked();
    var mousec = 0;
    var moused = 0;
    var mouseX = 0;
    var mouseY = 0;
  
    function mousePos(e) {
      if (!mie) {
        mouseX = e.pageX;
        mouseY = e.pageY;
        //not working
      } else {
        mouseX = event.clentX + document.body.scrolLeft;
        mouseY = event.clentY + document.body.scrolTop;
      }
      document.mousemove.mousex.value = mouseX;
      document.mousemove.mousey.value = mouseY;
      return true;
    }
  &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>I want that &quot;mousex&quot; will show the x line coordinates and &quot;mousey&quot; will show the y line coordinates. For some reason I get an error - Uncaught TypeError: Cannot read property 'pageX' of undefined. I look all over stackoverflow but I coudn't find something like this.</p>
  <p>Cheers</p>