Move the mouse pointer to a specific position?

Dennkster picture Dennkster · Jan 20, 2011 · Viewed 164.2k times · Source

I'm building a HTML5 game and I am trying to put the mouse cursor over a certain control on a specific event so that moving in a specific direction always has the same result. Is this possible?

Answer

Martin Jespersen picture Martin Jespersen · Jan 20, 2011

You cannot move the mousepointer with javascript.

Just think about the implications for a second, if you could ;)

  1. User thinks: "hey I'd like to click this link"
  2. Javascript moves mousecursor to another link
  3. User clicks wrong link and inadvertently downloads malware that formats his c-drive and eats his candy