图片边框响应鼠标变色
1.把<body>改为<BODY onmouseover=change() onmouseout="change()">
加入如下代码到head区域 <style> img{border:1px solid white} </style> <SCRIPT language=JavaScript> function change(){ var a=Math.random()*255; var b=Math.random()*255; var c=Math.random()*255; var color="rgb("+a+","+b+","+c+")"; if(event.type=="mouseover") { if (event.srcElement.tagName=="IMG") event.srcElement.style.border="1px solid "+color } if(event.type=="mouseout") { if (event.srcElement.tagName=="IMG") event.srcElement.style.border="1px solid white" } } </SCRIPT>
加入如下代码到body区域 <a href="#"><img src="1.gif"></a>