<!DOCTYPE html>
<html>
<body>
<p>将鼠标悬停在图像上以查看效果:</p>
<img onmouseover="this.src='bulbon.gif';" onmouseout="this.src='bulboff.gif';" src="bulboff.gif" alt="灯泡" style="width:100px;height:180px;">
<p><strong>解释说明:</strong></p>
<p>在这个示例中,我们使用了 <code>onmouseover</code> 和 <code>onmouseout</code> 事件来改变图像的源(src)属性。当鼠标悬停在图像上时,<code>onmouseover</code> 事件触发,图像会切换到 'bulbon.gif';当鼠标移开时,<code>onmouseout</code> 事件触发,图像会恢复到 'bulboff.gif'。</p>
</body>
</html>
上一篇:js explode
下一篇:js mouseup
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站