有什么方法可以通过不使用 :hover 并且不在所有元素中添加“onmouseover 和 onmouseout”来做到这一点,就像在脚本中为所有输入元素设置 onmouseover 和 onmouseout 的有效方法一样。
注意:在尝试使用 JQuery 之前,请先尝试使用 JavaScript
<head>
<title>123</title>
<style>
.button {
color: red;
}
.button:hover {
color: blue;
}
</style>
</head>
<body>
<div>
<input class="button" type="button" value="1">
<input class="button" type="button" value="2">
<input class="button" type="button" value="3">
</div>
</body>