JS keyboard events and focus events

Source: Internet
Author: User

Keyboard events
onkeydown//triggers when the keyboard is pressed
onkeyup//But triggered when the keyboard is lifted
Event.keycode//numeric type key values for keyboard keys
Function key Ctrlkey Shiftkey Altkey//Returns a Boolean value
Not all elements can receive keyboard events, can respond to user input elements, can hold the focus of elements to receive keyboard events

Document is a keyboard event that can receive

Focus: Enables the browser to distinguish between objects entered by the user, and when an element has the focus, he can receive input from the user.
We can set the focus of the element in some way
2 Tab key Toggle
3 JS
Not all elements can receive focus, and elements that respond to user actions have focus
What's the focus event?
onfocus//What to do when getting focus
onblur//What to do when you lose focus
Obj.focus ()//Add focus to Element
Obj.blur ()//method of canceling focus
Obj.select ()//Select text can be operated by the focus element is not supported under the standard

JS keyboard events and focus events

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.