Javascript programming (Lesson 6)

Source: Internet
Author: User

MouseDown event and mouseUp event

As you know, the combination of a mouseDown event and a mouseUp event is a click event. However, if you press the mouse over the link and move it out of the link to open the mouse, only the mouseD

Own event. These two events can increase the image effect of the icon button,
As for the attributes of mouseDown and mouseUp, they occur along with the Click event, which is the same mechanism as the keyDown event and keyUp event combination.

The three mouse events also have the modifier attribute.
(Note: If the return statement is used in onClick event processing, it can receive any value. The browser can complete the submission as long as the value is not False. However, if you browse

Is False, the form submission operation will be canceled .)

Click Event and dbClick event
OnClick is a click event, while onDblClick is a double-click event. In fact, it is difficult to distinguish between a continuous click and a double-click event. They interfere with each other. In addition, in ie and other browsers

Different. Some browsers trigger the click event every time a double-click event is clicked. in ie, only the first click of the double-click event triggers the click event. Click

Parts are not automatically canceled or ignored. Therefore, if you want to trigger two completely different processes by clicking or double-clicking a link, you must program the double-click action to know

Click.

Example:
<Script>
Var timer = null;
Document. onclick = new Function ("timer = setTimeout (click, 500 )")
Document. ondblclick = new Function ("clearTimeout (timer); dblclick ()")
Function click (){
Alert ("click ")
}
Function dblclick (){
Alert ("dblclick ")
}
</Script>

In a high-version browser, the linked Event Handlers both monitor the special actions that make the script block the link.
For example, to confirm certain data items before you want to navigate to another page, if some fields are incorrect, you can remind and terminate the link. To implement this validation, you must

The last statement of the event handler or the event handler itself returns True or False. If False is returned, the link is terminated.

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.