日期:2014-05-17 浏览次数:20978 次
<script type="text/javascript">
<!--
var lastSelected; //最后点击的元素
function over(obj){
obj.style.backgroundColor="red";
}
function out(obj){
if(obj == lastSelected )
obj.style.backgroundColor="green";
else
obj.style.backgroundColor="white";
}
function clicked(obj){
if(lastSelected != null)
{
lastSelected.style.backgroundColor="white";
}
lastSelected = obj;
obj.style.backgroundColor="green";
}
//-->
</script>
</head>
<body>
<table border="1">
<tr onmouseover="over(this)" onmouseout="out(this)" onclick="clicked(this)">
<td>1111</td>
<td>2222</td>
<td>3333</td>
</tr>
<tr onmouseover="over(this)" onmouseout="out(this)" onclick="clicked(this)">
<td>1111</td>
<td>2222</td>
<td>3333</td>
</tr>
</table>
</body>