HTML--鼠标事件
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>事件的触发</title> <script type="text/javascript"> function on_Mousedown() { alert("你按下了按钮,通过onmousedown方法触发了mousedown事件"); } function on_Mouseup() { alert("你按下鼠标并松开了,通过onmouseup方法触发了mouseup事件"); } function on_Mouseover() { alert("鼠标移动到了按钮,通过onmouseover方法触发了mouseover事件"); } function on_Mouseout() { alert("鼠标移出了按钮,通过onmouseout方法触发了mouseout事件"); } </script> </head> <body> <input type="button"value="按下鼠标触发事件"onmousedown="on_Mousedown();"/> <br /> <br /> <input type="button"value="按下鼠标松开时触发事件"onmouseup="on_Mouseup();"/> <br /> <br /> <input type="button" value="移动鼠标到按钮触发事件"onmouseover="on_Mouseover();"/> <br /> <br /> <input type="button"value="移开鼠标触发事件"onmouseout="on_Mouseout();"/> </body> </html>