DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> JavaScript綜合知識 >> js代碼-鼠標劃過時整行變色
js代碼-鼠標劃過時整行變色
編輯:JavaScript綜合知識     

 

<!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>
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved