JavaScript Event Response

Source: Internet
Author: User

The behavior that JavaScript creates in a dynamic page that can be heard by JavaScript is the event.

Triggering a Click event is typically creating an example of a button in HTML: <input name= "button" type= "button" value= "buttons" onclick= "function name ()" >

Clicking on this button will trigger the function within the onclick.

Mouse through and move out can be added in the text onmouseover= "function name ()" onmouseoue= "function name", you can implement the mouse through and move the event triggered.

OnChange and onselect are used within a text box, and onchange is triggered when the contents of the text box are changed.

onfocus triggers when the cursor is clustered onblur is the first time the cursor gathers and then moves away.

OnLoad is the event that fires when a page is loaded. OnUnload is the event that is triggered when you leave the page.

Event Flow: Describes the order in which events are accepted on the page.

Event bubbling is from the most specific element to the least specific element (document).

Event capture: From the most non-specific element to the most specific element.

Event object: An Event object is generated when a DOM event is generated. General use of event.

Event object events can get the type and destination of the event.

Event.type gets the type of event, what type of click event is the event or mouse over event, and so on. This is the Get event type.

Event.target gets the target of the event, which is the object that gets the element node of the event. The button event returns the DOM node of the button.

Event bubbling behavior: For example, there is a button tag within the DIV tag, and two tags have corresponding events. Event bubbling behavior occurs when the button is clicked and then the event is executed in the DIV tag, and the button is the most specific element that slowly passes through the div and then into the body to HTML. Actions can be implemented by blocking event bubbling behavior in event Events the button does not cause events in the div to fire, event.stoppropagation (), and prevents event bubbling behavior.

Block the default behavior of an event: for example, to write a hyperlink within a tag, click on the text in the a tag will appear jump, then if you want to prevent this jump behavior can use the event event to prevent the default behavior of the method. Event.preventdefault (); Gets the ID of the a tag and then adds the function function by using a handle to the default behavior of the block event.

JavaScript Event Response

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.