title: Capture mouse position on setInterval() in Javascript
body: <p>I have a function in Javascript that moves one div depending on the mouse position. This function is set on a <code>setInterval()</code> function and executed every second. I need to capture the mouse position like this:</p>
  <pre><code>function mousemov() {
    document.getElementById(&quot;myDiv&quot;).style.left = Event.clientX; //don't work
  }
  
  window.onload = function() {
    setInterval(&quot;mousemov()&quot;,1000);
  }
  </code></pre>
  <p>Ps: I cannot use the <code>mousemove</code> event because the function must be executed even if the mouse is stopped.</p>