Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Web
Expertise: Intermediate
Sep 29, 1998



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Cursors Ready

Using JavaScript, you can set up a form such that when the Web page is loaded the cursor is in the text box. This functionality avoids making the user click into the box--instead the user can just type. Through JavaScript and the Document Object Model, you can easily access the properties and methods of the HTML form elements on a page. One method shared by all of the HTML form elements is focus(). By calling this method you can move the cursor to any element you'd like. The associated code shows how to make this happen.

<FORM NAME="person">
First name: <INPUT TYPE="TEXT" NAME="first"><BR>
Last name: <INPUT TYPE="TEXT" NAME="last"><BR>
Address: <INPUT TYPE="TEXT" NAME="address"><BR>
<INPUT TYPE="button" VALUE="Save Data">

<SCRIPT LANGUAGE="Javascript">
// set focus to lastname

Boris Feldman
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date