JavaScript knowledge: trigger events

Source: Internet
Author: User

1. Click Event ___ onclick
Events generated when you click the mouse button. At the same time, the event handler or code specified by onclick will be called and executed.
For example, <input type = "button" value = "Open the page" onlick = "too many open('xxxx.html ', 'newwindow', 'width = 456, height = 230, toolbar = no, menubar = no, scrollbars = yes '); ">

2. Change event ___ onchange
This event occurs when the character values in the text or textarea element change or the select Table option state changes.
For example, <textarea name = "liuyan" rows = 5 cols = 70 value = "" onchange = alert ("You added new content to the text box")>

3. Selected event ____ onselect
This event is triggered when the text in the text or textarea object is selected.
For example: <ipnut type = "text" value = "default information" onselect = alert ("text in text box selected")>

4. Obtain the focus event ____ onfocus
When you click text, textarea, and select objects, this event is generated when the cursor falls in the text box or select box.
For example: <select name = "zhengjian" onfocus = "alert (" I am the Focus ")>

5. Loss of focus events ______ onblur
The loss of the Focus event is exactly opposite to the result of obtaining the focus event. This event is triggered when the text object, textarea object, or select object no longer has the focus and exits the background.

6. file loading event ____ onload
This event is generated when the page file is loaded. onload is used to detect the cookie value when loading a page file for the first time, and assign a value to it using a variable so that it can be used by the source code. This event is a window event, however, when an event handler is specified in HTML, it is generally written in the <body> tag.
For example: <body onload = alert ("loading page, please wait...")>

7. File uninstallation event ____ onunload
In contrast to the file loading event onload, the event is triggered when the web page exits and the cookie status can be updated.
For example, <body onunload = "confirm (" are you sure you want to leave this page? ")>

  • 2 pages in total:
  • Previous Page
  • 1
  • 2
  • Next Page

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.