1.鼠标经过事件:mouseOver;事件句柄为:onMouseOver
2.鼠标离开事件:mouseOut;事件句柄为:onMouseOut;
实例:另一个百度的超链接显示为蓝色,当鼠标经过的时候颜色变为红色,当鼠标离开的时候颜色变为蓝色;
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 2 "http://www.w3.org/TR/html4/loose.dtd"> 3 <html> 4 <head> 5 <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 6 <title></title> 7 8 <script type="text/javascript"> 9 10 function changeColor(colorValue){ 11 12 13 var baidu=document.getElementById("baidu"); 14 15 baidu.style.color=colorValue; 16 17 18 } 19 20 </script> 21 22 </head> 23 24 <body> 25 26 <a style="color:blue;text-decoration:underline; cursor:pointer" id="baidu" onMouseOver="changeColor('red')" onMouseOut="changeColor('blue')" >百度</a> 27 28 </body> 29 </html>