Forum Moderators: open
hello everyone:
I am learning JavaScript. I created a form and I want the mouse pointer points to the first field(a text filed) on the form when the form first displayed on the browser.
Could someone recommend a good JavaScript online tutorial / or online sources to accomplish this task? I appreciate your help?
I also want to what objects, events handler(s) do I need in order to set mourse pointer to a specific location no the form.
I appreciate your help!
Jeff
4-17-09
Under Windows, you can often set the mouse pointer to move to the default button in a dialog - but that is as far as it goes and very much a user preference.
You can, however, move focus to the first field in an HTML form, so the user doesn't have to click with the mouse to start typing.
In order to move to the first element (
elements[0]) on the first form (
forms[0]) on the page when the page loads, you could try...
<body onload="document.forms[0].elements[0].focus()">
This uses the forms array of the document object.
Confirmed: there is no way for Javascript to shove the user's pointer around the screen - the pointer is controlled by the user's mouse; manipulating that would be a highly annoying useability flaw, so browsers don't support it.
you can move elements to be under the pointer, but you can't move the pointer to be over an element.
hope that helps