onmouseover
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
<style type="text/css">
p {
background: gray;
color: white;
padding: 10px;
margin: 5px;
border: thin solid black
}
</style>
<script type="text/javascript">
function handleMouseOver(elem) {
elem.style.background = 'white';
elem.style.color = 'black';
}
function handleMouseOut(elem) {
elem.style.removeProperty('color');
elem.style.removeProperty('background');
}
</script>
</head>
<body>
<p onmouseover="handleMouseOver(this)"
onmouseout="handleMouseOut(this)">
This is a test.
</p>
<p onmouseover="handleMouseOver(this)"
onmouseout="handleMouseOut(this)">
This is a test.
</p>
</body>
</html>
Home
JavaScript Book
DOM
JavaScript Book
DOM
HTMLElement:
- The HTMLElement Members
- element tag name, id, direction, language, hidden disabled information
- addEventListener
- appendChild
- attributes returns a collection containing all of the attributes
- classList
- className
- cloneNode
- createElement
- createTextNode
- dataset
- getAttribute
- getElementsByTagName
- hasAttribute
- innerHTML
- insertAdjacentHTML
- insertBefore
- isSameNode
- outerHTML
- onmouseout
- onmouseover
- querySelectorAll
- removeEventListener