Home >Web Front-end >JS Tutorial >Getting Started with JavaScript Programming (Lesson 6)_Basic Knowledge
mouseDown event and mouseUp event
As we all know, the combination of mouseDown event and mouseUp event is click event, but if you press the mouse on the link, move it outside the link and release the mouse, then There is only mouseD
own event. These two events can increase the image effect of the icon button.
As for the properties of mouseDown and mouseUp, they occur along with the Click event. This is the same mechanism as the keyPress event, which is a combination of keyDown event and keyUp event
, these 3 mouse events also have modifier attributes.
(Note: If you use the return statement in onClick event processing, it can receive any value. As long as this value is not False, the browser can complete the submission. But if the browser
gets a False value , the form submission operation will be cancelled. )
Click event and dbClick event
onClick is a click event, onDblClick is a double-click event, and it is actually difficult to distinguish between continuous clicks and double-clicks. They interfere with each other. And the situation is
different between IE and other browsers. In some browsers, every click of a double-click event triggers a click event, but in IE, only the first click of a double-click event triggers a click event. Regardless, clicks on
events will not be automatically canceled or ignored. Therefore, if you want to trigger two completely different processes when clicking and double-clicking a link, you must programmatically delay the click action until the double-click.
Example:
In later browsers, both event handlers for links monitor special behavior that causes scripts to block links.
For example: Confirm certain data items before you want to navigate to another page. If some fields are filled in incorrectly, you can be reminded and terminate the link. To achieve this confirmation, the last statement in the
event handler or the event handler itself must return True or False. If False is returned, the connection is terminated.