Definition and Usage The onmousemove attribute is triggered when the mouse pointer moves over the element. Note: The onmousemove attribute does not apply to the following elements: , ,
, , Definition and Usage The onmousemove attribute is triggered when the mouse pointer moves over the element. Note: The onmousemove attribute does not apply to the following elements: , ,
, ,

Home >Web Front-end >HTML Tutorial >Introduction to the usage of several event attributes

Introduction to the usage of several event attributes

巴扎黑
巴扎黑Original
2017-06-16 17:25:231403browse

Execute a section when the mouse pointer moves over the image JavaScript:

<img onmousemove="bigImg(this)" src="smiley.gif" alt="Smiley">

Definition and usage

The onmousemove attribute is triggered when the mouse pointer moves over the element.

Note: The onmousemove attribute does not apply to the following elements: dde6fb694e6711ae5e6f381704c04ae4, 71af07a0e88a1ac1ff73f855702ac153, 0c6dc11e160d3b678d68754cc175188a, 93f0f5c25f18dab9d176bd4f6de5d30e, 100db36a723c770d327fc0aef2ce13b1, d5ba1642137c3f32f4f4493ae923989c, e8e496c15ba93d81f6ea4fe5f55a2244, 0c68fef83818661b6da588c77ca3985e, 3f1c4e4b6b16bbbd69b2ee476dc4f83a, c9ccee2e6ea535a969eb3f532ad9fe89 or b2386ffb911b14667cb8f0f91ea547a7.

Differences between HTML 4.01 and HTML5: None.

Syntax

<element onmousemove="script">

Attribute value Value Description

script The script that runs when onmousemove occurs.

Execute a piece of JavaScript when the text in the d5fd7aea971a85678ba271703566ebfd element is selected:

<input type="text" onselect="showMsg() value="Hello world!">

Definition and usage

onselect attribute is triggered when the text in the element is selected.

onselect attribute can be used within the following elements: 3525558f8f338d4ea90ebf22e5cde2bc, 794332e4da1b97221ff0ba8bc66903c4, 23efcc05e98690ceeb219581933e4231, 84508603c7fd0f176da73ee8fcc6c902.

Differences between HTML 4.01 and HTML5

None.

Syntax

<element onselect="script">

Attribute value Value Description

script The script that runs when onselect occurs.

Example

Execute a piece of JavaScript when the user presses a key:

ae1c216fa2a755912b88ce85bce3a981

Definition and Usage

onkeypress property is triggered when the user presses a key (on the keyboard).

Tip: Event order relative to onkeypress events:

onkeydown onkeypress onkeyup

Notes: In any browser , the onkeypress event will not be triggered by all keys (such as ALT, CTRL, SHIFT, ESC).

Note: The onkeypress attribute is not applicable to the following elements: dde6fb694e6711ae5e6f381704c04ae4, 71af07a0e88a1ac1ff73f855702ac153, 0c6dc11e160d3b678d68754cc175188a, 93f0f5c25f18dab9d176bd4f6de5d30e, 100db36a723c770d327fc0aef2ce13b1, d5ba1642137c3f32f4f4493ae923989c, e8e496c15ba93d81f6ea4fe5f55a2244, 0c68fef83818661b6da588c77ca3985e, 3f1c4e4b6b16bbbd69b2ee476dc4f83a, c9ccee2e6ea535a969eb3f532ad9fe89 or b2386ffb911b14667cb8f0f91ea547a7.

Differences between HTML 4.01 and HTML5

None.

Grammar

<element onkeypress="script">

The above is the detailed content of Introduction to the usage of several event attributes. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn