W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <div onmousedown="mDown(this)" onmouseup="mUp(this)" style="background-color:#D94A38;width:90px;height:20px;padding:40px;"> 点击鼠标</div> <script> function mDown(obj) { obj.style.backgroundColor = "#1ec5e5"; obj.innerHTML = "松开鼠标"; } function mUp(obj) { obj.style.backgroundColor="#D94A38"; obj.innerHTML="谢谢您"; } </script> </body> </html>