views:

3425

answers:

3

I have a link that, when clicked, I would like it to move the position of the mouse to the right (or anywhere within the viewport, for that matter).

in code it would probably look similar to the following:

$('a#expand').click(function(e){
    $(document)
       .mouseXPos(e.pageX + 50)
       .mouseYPos(e.pageY + 50);
});

Chaining might not be necessary, of course, but a similar 'set mouse position' functionality is what I am after.

I've seen solutions to move the cursor position to a certain spot in the text, but I didn't glean much from them.

Thanks in advance for your time and help. -Michael

+2  A: 

I may be wrong, but I don't think it's possible to move the mouse pointer from client-side script. Given the potential for abuse, I certainly hope it isn't.

Jason Musgrove
I had definitely thought about the worry about this. Should I ever come across such a power, I'll be sure to find a solution to it and let you know. Do you know of a server-side script to do this?Thanks.
Michael
@Michael: Server-side script is even less likely to move the client's mouse pointer. It *may* be possible to move the mouse pointer via ActiveX control (Internet Explorer only), custom plugin, .NET control, or possibly by signed Java applet.
Jason Musgrove
+1  A: 

There is no mechanism for moving the mouse via JavaScript.

CptSkippy
Any mechanism for ASP.Net, AJAX, jQuery, C#?I know the mouse position can be read via jQuery, maybe there's a way to expose it via the DOM?
Michael
@Michael: No, the mouse position is read-only for JavaScript. AJAX is just method of communication for JavaScript executing on the client to talk to a server Application via HTTP. ASP.NET/C# is server side and it's scope is limited to the server it executes on. The only way to control a client's mouse is with a client side application that is running in user space which means getting them to download and install something.
CptSkippy
A: 

There's no way to accomplish mouse position change via JavaScript or any Client-Side Script. The only reason for that is not to give a client side script potential for abuse as stated before.

George

related questions