<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>单元格背景色鼠标响应</title>
<script language="javascript">
<!--
var aTDClick=new Array(3);
function onColor(td,n){
if(!aTDClick[n-1]){
td.style.backgroundColor='#FFFF99';
td.style.color='#0600FF';
}else{
td.style.backgroundColor='#FF6699';
td.style.color='#0600FF';
}
}
function onClickColor(td,n){
var TR1=document.getElementById("TR1");
var TR2=document.getElementById("TR2");
var TR3=document.getElementById("TR3");
switch(n){
case 1:
if(aTDClick[0]!==true){
td.style.backgroundColor='#FF6699';
td.style.color='#0600FF';
aTDClick[0]=true;
}else{
TR1.style.backgroundColor='';
TR1.style.color='';
aTDClick[0]=false;
}
TR2.style.backgroundColor='';
TR2.style.color='';
TR3.style.backgroundColor='';
TR3.style.color='';
aTDClick[1]=false;
aTDClick[2]=false;
break;
case 2:
if(aTDClick[1]!==true){
td.style.backgroundColor='#FF6699';
td.style.color='#0600FF';
aTDClick[1]=true;
}else{
TR2.style.backgroundColor='';
TR2.style.color='';
aTDClick[1]=false;
}
TR1.style.backgroundColor='';
TR1.style.color='';
TR3.style.backgroundColor='';
TR3.style.color='';
aTDClick[0]=false;
aTDClick[2]=false;
break;
case 3:
if(aTDClick[2]!==true){
td.style.backgroundColor='#FF6699';
td.style.color='#0600FF';
aTDClick[2]=true;
}else{
TR3.style.backgroundColor='';
TR3.style.color='';
aTDClick[2]=false;
}
TR2.style.backgroundColor='';
TR2.style.color='';
TR1.style.backgroundColor='';
TR1.style.color='';
aTDClick[1]=false;
aTDClick[0]=false;
break;
}
}
function offColor(td,n){
if(!aTDClick[n-1]){
td.style.backgroundColor='';
td.style.color='';
}else{
td.style.backgroundColor='#FF6699';
td.style.color='#0600FF';
}
}
-->
</script>
<style type="text/css">
<!--
.light {
font: normal 9pt "宋体";
color: #000000;
text-decoration: none;
background: #FFFFFF;
cursor: default;
}
.tdstyle {
border: 1px dashed #0099CC;
}
-->
</style></head><body>
<table border="0" cellpadding="0" cellspacing="4" width="100%">
<tbody><tr>
<td style="" id="TR1" class="tdstyle" onmouseover="onColor(this,1);" onmouseout="offColor(this,1);" onclick="onClickColor(this,1);" height="25">菜单1</td>
<td id="TR2" class="tdstyle" onmouseover="onColor(this,2);" onmouseout="offColor(this,2);" onclick="onClickColor(this,2);" height="25">菜单2</td>
<td id="TR3" class="tdstyle" onmouseover="onColor(this,3);" onmouseout="offColor(this,3);" onclick="onClickColor(this,3);" height="25">菜单3</td>
</tr>
</tbody></table>
</body></html>
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>单元格背景色鼠标响应</title>
<script language="javascript">
<!--
var aTDClick=new Array(3);
function onColor(td,n){
if(!aTDClick[n-1]){
td.style.backgroundColor='#FFFF99';
td.style.color='#0600FF';
}else{
td.style.backgroundColor='#FF6699';
td.style.color='#0600FF';
}
}
function onClickColor(td,n){
var TR1=document.getElementById("TR1");
var TR2=document.getElementById("TR2");
var TR3=document.getElementById("TR3");
switch(n){
case 1:
if(aTDClick[0]!==true){
td.style.backgroundColor='#FF6699';
td.style.color='#0600FF';
aTDClick[0]=true;
}else{
TR1.style.backgroundColor='';
TR1.style.color='';
aTDClick[0]=false;
}
TR2.style.backgroundColor='';
TR2.style.color='';
TR3.style.backgroundColor='';
TR3.style.color='';
aTDClick[1]=false;
aTDClick[2]=false;
break;
case 2:
if(aTDClick[1]!==true){
td.style.backgroundColor='#FF6699';
td.style.color='#0600FF';
aTDClick[1]=true;
}else{
TR2.style.backgroundColor='';
TR2.style.color='';
aTDClick[1]=false;
}
TR1.style.backgroundColor='';
TR1.style.color='';
TR3.style.backgroundColor='';
TR3.style.color='';
aTDClick[0]=false;
aTDClick[2]=false;
break;
case 3:
if(aTDClick[2]!==true){
td.style.backgroundColor='#FF6699';
td.style.color='#0600FF';
aTDClick[2]=true;
}else{
TR3.style.backgroundColor='';
TR3.style.color='';
aTDClick[2]=false;
}
TR2.style.backgroundColor='';
TR2.style.color='';
TR1.style.backgroundColor='';
TR1.style.color='';
aTDClick[1]=false;
aTDClick[0]=false;
break;
}
}
function offColor(td,n){
if(!aTDClick[n-1]){
td.style.backgroundColor='';
td.style.color='';
}else{
td.style.backgroundColor='#FF6699';
td.style.color='#0600FF';
}
}
-->
</script>
<style type="text/css">
<!--
.light {
font: normal 9pt "宋体";
color: #000000;
text-decoration: none;
background: #FFFFFF;
cursor: default;
}
.tdstyle {
border: 1px dashed #0099CC;
}
-->
</style></head><body>
<table border="0" cellpadding="0" cellspacing="4" width="100%">
<tbody><tr>
<td style="" id="TR1" class="tdstyle" onmouseover="onColor(this,1);" onmouseout="offColor(this,1);" onclick="onClickColor(this,1);" height="25">菜单1</td>
<td id="TR2" class="tdstyle" onmouseover="onColor(this,2);" onmouseout="offColor(this,2);" onclick="onClickColor(this,2);" height="25">菜单2</td>
<td id="TR3" class="tdstyle" onmouseover="onColor(this,3);" onmouseout="offColor(this,3);" onclick="onClickColor(this,3);" height="25">菜单3</td>
</tr>
</tbody></table>
</body></html>