JavaScript Event _ Event handler overview and handling functions for mouse events

Source: Internet
Author: User

I. Overview of event handler functions

The types of events that JavaScript can handle are: mouse events, keyboard events, HTML events.

All event handlers are made up of two parts, the on + event name, such as the event handler for the Click event: OnClick.

For each event, it has its own trigger range and mode, and if the trigger range and mode are exceeded, the event processing will be invalidated.

  

Second, mouse events: All elements of the page can be triggered

  1 . Click: triggers when the user clicks the mouse button or presses the ENTER key.

<script type= "Text/javascript" >    function() {        var input = document.getElementsByTagName (' input ') [0];         function () {            alert (' Lee ');        };    } </script>

  

 2. DblClick: Triggered when the user double-clicks the primary mouse button.

<script type= "Text/javascript" >    function() {        var input = document.getElementsByTagName (' input ') [0];         function () {            alert (' Lee ');        };    } </script>

  

  3, MouseDown: When the user pressed the mouse has not bounced when the trigger.

<script type= "Text/javascript" >    function() {        var input = document.getElementsByTagName (' input ') [0];          function () {            alert (' Lee ');        };    } </script>

4.MouseUp: triggers when the user releases the mouse button.

<script type= "Text/javascript" >    function() {        var input = document.getElementsByTagName (' input ') [0];         function () {            alert (' Lee ');        };    } </script>

5,mouseover: triggered when the mouse moves over an element.

<script type= "Text/javascript" >    function() {        var input = document.getElementsByTagName (' input ') [0];         function () {            alert (' Lee ');        };    } </script>

  6.mouseout: Triggers when the mouse moves out of an element.

<script type= "Text/javascript" >    function() {        var input = document.getElementsByTagName (' input ') [0];           function () {            alert (' Lee ');        };    } </script>

7.mousemove: Triggers when the mouse pointer moves over an element (triggered when mouseover is almost moved to an element).

<script type= "Text/javascript" >    function() {        var input = document.getElementsByTagName (' input ') [0];           function () {            alert (' Lee ');        };    } </script>

JavaScript Event _ Event handler overview and handling functions for mouse events

Related Article

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.