-1

I would like to know how can I create a mouse move after pressing a button? I am a fish in coding starting with a simple project and would love to create a step by step clicking process where the mouse will be scrolling and pointing in a certain point, img, or maybe to a class of my project?

  • 7
    Java **IS NOT** JavaScript. Please edit the tags accordingly and provide relevant code to reproduce your problem, otherwise is very unclear what you're asking. – Luiggi Mendoza Feb 06 '15 at 17:35
  • For aught I know there is no mechanism for moving the mouse via JavaScript (if you want to use JS): only allows read the mouse position. (read-only) – tomloprod Feb 06 '15 at 17:39
  • If you really are talking about Javascript/PHP you can't move the mouse but you can move the scrollbars. Using anchor tags may work well for this. – Nathan Feb 06 '15 at 18:07

3 Answers3

1

Currently, there is no way to force a mouse movement via Javascript mainly due to its security implications.

In your case, you can use focus to guide the user to the specific portion of the page that you want.

Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332
William J.
  • 1,574
  • 15
  • 26
  • thanks, you are talking about something like this? http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_html_blur this is not bad, can add an effect to an element and it will probably be even better than the mouse movement as Java Robot class. – Webdesignlover Feb 06 '15 at 22:59
  • Yes, something like that! Of course you should adapt it to your scenario but that's the basic idea. You can also use automatic scrolling, animations, things like that. – William J. Feb 06 '15 at 23:05
  • If you're using Jquery take a look at this: http://api.jquery.com/animate/ it might give you some ideas – William J. Feb 06 '15 at 23:11
  • Thanks. I think I will start with the html it look good, I will add a nice shadow effect and lil bounce so the user will look direclty on the place I want. I think it is better than moving his mouse :) will try, will see, have a good day – Webdesignlover Feb 06 '15 at 23:18
0

You cannot move the mouse in JavaScript for the moment. What you can do however is scrolling the page so that a elements goes under the mouse cursor.

My idea is to move the element you want with JavaScript under the mouse cursor. When the user clicks your button, you can, in the event handler capture the mouse coordinates and use those to place any element exactly under the mouse cursor.

The result of the mouse cursor is above this element can be achieved that way.

Walle Cyril
  • 3,087
  • 4
  • 23
  • 55
0

try to Create COM, then client will ask to accept some installation.

see here ; http://febru.soluvas.com/2015/02/javascript-move-mouse.html

  • Please place the relevant code and explanation here rather than a link ... links can change over time which would make your answer invalid. – rfornal Feb 14 '15 at 14:32