W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<html> <head> <style> input { background-image:url('/i/eg_bg_03.gif'); width:156px; height:111px; } </style> <script type="text/javascript"> function over() { if (event.srcElement.tagName=="INPUT") { event.srcElement.style.backgroundImage="url('/i/eg_bg_04.gif')" } } function out() { if (event.srcElement.tagName=="INPUT") { event.srcElement.style.backgroundImage="url('/i/eg_bg_07.gif')" } } </script> </head> <body> <p>请把鼠标移动到图像上:</p> <form onmouseout="out()" onmouseover="over()"> <input class="a" type="button" value="按钮 1"><br /> <input class="b" type="button" value="按钮 2"><br /> <input class="c" type="button" value="按钮 3"><br /> </form> </body> </html>