WEB开发网
开发学院网页设计JavaScript js代码-鼠标划过时整行变色 阅读

js代码-鼠标划过时整行变色

 2012-12-21 20:08:49 来源:WEB开发网   
核心提示: aaa aaa aaa aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
 
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<script>
function overIt(){
   var the_obj = event.srcElement;
   if(the_obj.tagName.toLowerCase() == "td"){
       the_obj=the_obj.parentElement;
       the_obj.oBgc=the_obj.currentStyle.backgroundColor;            
	   the_obj.oFc=the_obj.currentStyle.color;
       the_obj.style.backgroundColor='#71BAF0';
       the_obj.style.color='';
   }
}
function outIt(){
   var the_obj = event.srcElement;
   if(the_obj.tagName.toLowerCase() == "td"){
       the_obj=the_obj.parentElement;
       the_obj.style.backgroundColor=the_obj.oBgc;
       the_obj.style.color=the_obj.oFc;
       the_obj.style.textDecoration='';
   }
}
</script>

</head>
  
  <body>
<table border=1 width=400 onmouseover="overIt()" onmouseout="outIt()">
	<tr bgColor=#111111> 
		<td>aaa</td>
		<td>aaa</td>
		<td>aaa</td>
		<td>aaa</td>
	</tr>
	<tr bgColor=#222222> 
		<td>aaa</td>
		<td>aaa</td>
		<td>aaa</td>
		<td>aaa</td>
	</tr>
	<tr bgColor=#333333> 
		<td>aaa</td>
		<td>aaa</td>
		<td>aaa</td>
		<td>aaa</td>
	</tr>
	<tr bgColor=#444444> 
		<td>aaa</td>
		<td>aaa</td>
		<td>aaa</td>
		<td>aaa</td></tr>
	<tr bgColor=#555555> 
		<td>aaa</td>
		<td>aaa</td>
		<td>aaa</td>
		<td>aaa</td>
	</tr>
</table>
  </body>
</html>
 

Tags:js 代码 鼠标

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接