Home > Web Front-end > JS Tutorial > The onkeydown event solves the need to directly submit data by pressing the Enter key_javascript skills

The onkeydown event solves the need to directly submit data by pressing the Enter key_javascript skills

WBOY
Release: 2016-05-16 17:37:32
Original
1435 people have browsed it

The login page needs to capture the user's need to press Enter to submit automatically:
Add an onkeydown event in the body to jump to the javascript before submitting the form.

Find the document as follows
The onkeydown event occurs when the user presses a keyboard key.
Syntax: onkeydown="SomeJavaScriptCode"

HTML tags that support this event;

Copy code The code is as follows:

, ,
, , , , , ,