超酷的鼠标可以任意拖拽的网页中的层 dn001 2009-06-21 08:23:19 <!-- http://www.knowsky.com --> <!-- bbs http://www.knowsky.com/bbs--> <!--要完成此效果需要两个步骤 第一步:把如下代码加入到<head>区域中--> <script language="JavaScript1.2"> function changeto(highlightcolor){ source=event.srcElement if (source.tagName=="TR"||source.tagName=="TABLE") return while(source.tagName!="TD") source=source.parentElement if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore") source.style.backgroundColor=highlightcolor } function changeback(originalcolor){ if (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore") return if (event.toElement!=source) source.style.backgroundColor=originalcolor } </script> <!--第二步:把如下代码加入到<body>区域中--> <table width="30%" border="1" align="center" onMouseover="changeto('33ff33')" onMouseout="changeback('black')" > <tr> <td> <div align="center">http://www.knowsky.com</div> </td> </tr> <tr> <td> <div align="center">http://www.knowsky.com</div> </td> </tr> <tr> <td> <div align="center">http://www.knowsky.com</div> </td> </tr> <tr> <td> <div align="center">http://www.knowsky.com</div> </td> </tr> <tr> <td> <div align="center">http://www.knowsky.com</div> </td> </tr> </table>