W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <img onmouseenter="bigImg(this)" onmouseleave="normalImg(this)" border="0" src="/i/photo/smile.gif" alt="Smiley" width="128" height="128"> <p>当用户将鼠标指针移动到图像上时会触发函数 bigImg()。</p> <p>当鼠标指针移出图像时会触发函数 normalImg()。</p> <script> function bigImg(x) { x.style.height = "256px"; x.style.width = "256px"; } function normalImg(x) { x.style.height = "128px"; x.style.width = "128px"; } </script> </body> </html>