【长夜漫漫无心睡眠,只因心中大有疑问】请教各位达人 <tr id="td" onmouseover="test('td')" onmouseout="test2('td')"> <td > <font id="tt_td">aaaaaa</font> </td><td>dgdfgdg</td></tr>把动作放在TR上 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 function test(id){ //逐渐变黑 var o = document.getElementById(id) clearTimeout(o.a);clearTimeout(o.b); if(o.colorNumber == 0 && o.colorNumber2 == 255) return; if(!o.colorNumber) o.colorNumber=255 if(!o.colorNumber2) o.colorNumber2=0 o.colorNumber -= 17; o.colorNumber2 += 17; if(o.colorNumber < 0){ o.colorNumber = 0; } if(o.colorNumber2 > 255){ o.colorNumber2 = 255; } c2 = getColor(o.colorNumber2); c = getColor(o.colorNumber); o.style.background = "#"+c+c+c; document.getElementById("tt_"+id).style.color = "#"+c2+c2+c2; o.a=setTimeout("test('"+id+"')",39); } function test2(id){ //逐渐变白 var o = document.getElementById(id) clearTimeout(o.a);clearTimeout(o.b); if(o.colorNumber == 255 && o.colorNumber2 == 0) return; if(!o.colorNumber) o.colorNumber=0 if(!o.colorNumber2) o.colorNumber2=255 o.colorNumber += 17; o.colorNumber2 -= 17; if(o.colorNumber > 255){ o.colorNumber = 255; } if(o.colorNumber2 < 0){ o.colorNumber2 = 0; } //alert(c); c = getColor(o.colorNumber); c2 = getColor(o.colorNumber2); o.style.background = "#"+c+c+c; document.getElementById("tt_"+id).style.color = "#"+c2+c2+c2; o.b=setTimeout("test2('"+id+"')",39); } function getColor(number){ //返回16进制数 if(number<0){ return "00"; } if(number>255){ return "FF" } var color = number.toString(16); if(color.length==1){ color = "0"+color; } return color; } <tr id="td" onmouseover="test('td')" onmouseout="test2('td')"> <td > <font id="tt_td">aaaaaa</font> </td><td>dgdfgdg</td></tr> <tr id="td" onmouseover="test('td')" onmouseout="test2('td')"> 结合了楼上几位的意见,加以改进了一下,LZ试试<!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></head><script type="text/javascript"> function test(id){ //逐渐变黑 var o = document.getElementById(id) clearTimeout(o.a);clearTimeout(o.b); if(o.colorNumber == 0 && o.colorNumber2 == 255) return; if(!o.colorNumber) o.colorNumber=255 if(!o.colorNumber2) o.colorNumber2=0 o.colorNumber -= 17; o.colorNumber2 += 17; if(o.colorNumber < 0){ o.colorNumber = 0; } if(o.colorNumber2 > 255){ o.colorNumber2 = 255; } c2 = getColor(o.colorNumber2); c = getColor(o.colorNumber); o.style.background = "#"+c+c+c; document.getElementById("tt_"+id).style.color = "#"+c2+c2+c2;document.getElementById("tt_"+id+"1").style.color = "#"+c2+c2+c2; o.a=setTimeout("test('"+id+"')",39); } function test2(id){ //逐渐变白 var o = document.getElementById(id) clearTimeout(o.a);clearTimeout(o.b); if(o.colorNumber == 255 && o.colorNumber2 == 0) return; if(!o.colorNumber) o.colorNumber=0 if(!o.colorNumber2) o.colorNumber2=255 o.colorNumber += 17; o.colorNumber2 -= 17; if(o.colorNumber > 255){ o.colorNumber = 255; } if(o.colorNumber2 < 0){ o.colorNumber2 = 0; } //alert(c); c = getColor(o.colorNumber); c2 = getColor(o.colorNumber2); o.style.background = "#"+c+c+c; document.getElementById("tt_"+id).style.color = "#"+c2+c2+c2;document.getElementById("tt_"+id+"1").style.color = "#"+c2+c2+c2; o.b=setTimeout("test2('"+id+"')",39); } function getColor(number){ //返回16进制数 if(number<0){ return "00"; } if(number>255){ return "FF" } var color = number.toString(16); if(color.length==1){ color = "0"+color; } return color; }</script><body> <table align="center" border="0" width="200"bordercolor="#000099"> <tr id="td" onmouseover="test('td')" onmouseout="test2('td')"> <td> <font id="tt_td">aaaaaa</font> </td><td> <font id="tt_td1">bbbb</font> </td> </tr> <tr id="td2" onmouseover="test('td2')" onmouseout="test2('td2')"> <td> <font id="tt_td2">aaaaaa</font> </td><td> <font id="tt_td21">bbbb</font> </td> </tr> <tr id="td3" onmouseover="test('td3')" onmouseout="test2('td3')"> <td> <font id="tt_td3">aaaaaa</font> </td><td> <font id="tt_td31">bbbb</font> </td> </tr> </table></body></html> <!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></head><script language="javascript"><!--var steplength=32;var waitlength=39;function feedin(obj){ obj.red=255 obj.green=255; obj.blue=255; if(obj.interval!=null) clearInterval(obj.interval); var func=function(){ obj.red-=steplength; obj.green-=steplength; obj.blue-=steplength; var color="#"+getColor(obj.red)+getColor(obj.green)+getColor(obj.blue); obj.style.background=color; if(obj.red<0||obj.green<0||obj.blue<0){ clearInterval(obj.interval); } } obj.interval=setInterval(func,waitlength);}function feedout(obj){ obj.red=0 obj.green=0; obj.blue=0; if(obj.interval!=null) clearInterval(obj.interval); var func=function(){ obj.red+=steplength; obj.green+=steplength; obj.blue+=steplength; var color="#"+getColor(obj.red)+getColor(obj.green)+getColor(obj.blue); obj.style.background=color; if(obj.red<0||obj.green<0||obj.blue<0){ clearInterval(obj.interval); } } obj.interval=setInterval(func,waitlength);}function changecolor(stepred,stepgreen,stepblue){ red=red+stepred; green=green+stepgreen; blue=blue+stepblue; return ("#"+getColor(red)+getColor(green)+getColor(blue));}function getColor(number){ //返回16进制数 if(number<0){ return "00"; } if(number>255){ return "FF" } var color = number.toString(16); if(color.length==1){ color = "0"+color; } return color;}--></script><style type="text/css"><!--.shade { text-align:center; star : expression( onmouseover=function(){ feedin(this); }, onmouseout=function(){ feedout(this); } )}--></style><body> <table align="center" border="0" width="200"> <tr><td class="shade">第一行文字</td></tr> <tr><td class="shade">第二行文字</td></tr> <tr><td class="shade">第三行文字</td></tr> <tr><td class="shade">第四行文字</td></tr> <tr><td class="shade">第五行文字</td></tr> <tr><td class="shade">第六行文字</td></tr> <tr><td class="shade">第七行文字</td></tr> <tr><td class="shade">第八行文字</td></tr> <tr><td class="shade">第九行文字</td></tr> <tr><td class="shade">第十行文字</td></tr> </table></body></html>把分给我吧…… <!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> </head> <script language="javascript"> <!-- var steplength=32; var waitlength=39; function feedin(obj){ obj.red=255 obj.green=255; obj.blue=255; if(obj.interval!=null) clearInterval(obj.interval); var func=function(){ obj.red-=steplength; obj.green-=steplength; obj.blue-=steplength; var color="#"+getColor(obj.red)+getColor(obj.green)+getColor(obj.blue); obj.style.background=color; if(obj.red <0||obj.green <0||obj.blue <0){ clearInterval(obj.interval); } } obj.interval=setInterval(func,waitlength); } function feedout(obj){ obj.red=0 obj.green=0; obj.blue=0; if(obj.interval!=null) clearInterval(obj.interval); var func=function(){ obj.red+=steplength; obj.green+=steplength; obj.blue+=steplength; var color="#"+getColor(obj.red)+getColor(obj.green)+getColor(obj.blue); obj.style.background=color; if(obj.red <0||obj.green <0||obj.blue <0){ clearInterval(obj.interval); } } obj.interval=setInterval(func,waitlength); } function changecolor(stepred,stepgreen,stepblue){ red=red+stepred; green=green+stepgreen; blue=blue+stepblue; return ("#"+getColor(red)+getColor(green)+getColor(blue)); } function getColor(number){ //返回16进制数 if(number <0){ return "00"; } if(number>255){ return "FF" } var color = number.toString(16); if(color.length==1){ color = "0"+color; } return color; } --> </script> <style type="text/css"> <!-- .shade { text-align:center; star : expression( onmouseover=function(){ feedin(this); }, onmouseout=function(){ feedout(this); } ) } --> </style> <body> <table align="center" border="0" width="200"> <tr> <td class="shade">第一行文字 </td> </tr> <tr> <td class="shade">第二行文字 </td> </tr> <tr> <td class="shade">第三行文字 </td> </tr> <tr> <td class="shade">第四行文字 </td> </tr> <tr> <td class="shade">第五行文字 </td> </tr> <tr> <td class="shade">第六行文字 </td> </tr> <tr> <td class="shade">第七行文字 </td> </tr> <tr> <td class="shade">第八行文字 </td> </tr> <tr> <td class="shade">第九行文字 </td> </tr> <tr> <td class="shade">第十行文字 </td> </tr> </table> </body> </html> Highcharts 怎么使用 求助!!!!根据字符串找出元素是什么? javascript单击事件问题 关于浏览器地址的获取,在线等,谢谢 js能实现vbscript中的msgbox这个功能吗?(即弹出是,否,取消) 求一滚动效果的代码,JS或者纯CSS的都可以。 window.setTimeout重定义,急!在线等。 关于弹出一新窗口的问题。 取一定長度的字符串(不是個數) highChart横坐标问题 写了一个提示输入多少字符的js。 但是ie下有问题。 ff没有问题。大家帮个忙看看。 onmouseover="this.style.cursor='hand'"
var o = document.getElementById(id)
clearTimeout(o.a);clearTimeout(o.b);
if(o.colorNumber == 0 && o.colorNumber2 == 255) return;
if(!o.colorNumber) o.colorNumber=255
if(!o.colorNumber2) o.colorNumber2=0
o.colorNumber -= 17;
o.colorNumber2 += 17;
if(o.colorNumber < 0){ o.colorNumber = 0; }
if(o.colorNumber2 > 255){ o.colorNumber2 = 255; }
c2 = getColor(o.colorNumber2);
c = getColor(o.colorNumber);
o.style.background = "#"+c+c+c;
document.getElementById("tt_"+id).style.color = "#"+c2+c2+c2;
o.a=setTimeout("test('"+id+"')",39);
}
function test2(id){ //逐渐变白
var o = document.getElementById(id)
clearTimeout(o.a);clearTimeout(o.b);
if(o.colorNumber == 255 && o.colorNumber2 == 0) return;
if(!o.colorNumber) o.colorNumber=0
if(!o.colorNumber2) o.colorNumber2=255
o.colorNumber += 17;
o.colorNumber2 -= 17;
if(o.colorNumber > 255){ o.colorNumber = 255; }
if(o.colorNumber2 < 0){ o.colorNumber2 = 0; }
//alert(c);
c = getColor(o.colorNumber);
c2 = getColor(o.colorNumber2);
o.style.background = "#"+c+c+c;
document.getElementById("tt_"+id).style.color = "#"+c2+c2+c2;
o.b=setTimeout("test2('"+id+"')",39); }
function getColor(number){ //返回16进制数
if(number<0){
return "00";
}
if(number>255){
return "FF"
}
var color = number.toString(16);
if(color.length==1){
color = "0"+color;
}
return color;
}
<td >
<font id="tt_td">aaaaaa</font>
</td><td>dgdfgdg</td>
</tr>
<tr id="td" onmouseover="test('td')" onmouseout="test2('td')">
<!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>
</head>
<script type="text/javascript">
function test(id){ //逐渐变黑
var o = document.getElementById(id)
clearTimeout(o.a);clearTimeout(o.b);
if(o.colorNumber == 0 && o.colorNumber2 == 255) return;
if(!o.colorNumber) o.colorNumber=255
if(!o.colorNumber2) o.colorNumber2=0
o.colorNumber -= 17;
o.colorNumber2 += 17;
if(o.colorNumber < 0){ o.colorNumber = 0; }
if(o.colorNumber2 > 255){ o.colorNumber2 = 255; }
c2 = getColor(o.colorNumber2);
c = getColor(o.colorNumber);
o.style.background = "#"+c+c+c;
document.getElementById("tt_"+id).style.color = "#"+c2+c2+c2;
document.getElementById("tt_"+id+"1").style.color = "#"+c2+c2+c2; o.a=setTimeout("test('"+id+"')",39);
}
function test2(id){ //逐渐变白
var o = document.getElementById(id)
clearTimeout(o.a);clearTimeout(o.b);
if(o.colorNumber == 255 && o.colorNumber2 == 0) return;
if(!o.colorNumber) o.colorNumber=0
if(!o.colorNumber2) o.colorNumber2=255
o.colorNumber += 17;
o.colorNumber2 -= 17;
if(o.colorNumber > 255){ o.colorNumber = 255; }
if(o.colorNumber2 < 0){ o.colorNumber2 = 0; }
//alert(c);
c = getColor(o.colorNumber);
c2 = getColor(o.colorNumber2);
o.style.background = "#"+c+c+c;
document.getElementById("tt_"+id).style.color = "#"+c2+c2+c2;
document.getElementById("tt_"+id+"1").style.color = "#"+c2+c2+c2;
o.b=setTimeout("test2('"+id+"')",39); }
function getColor(number){ //返回16进制数
if(number<0){
return "00";
}
if(number>255){
return "FF"
}
var color = number.toString(16);
if(color.length==1){
color = "0"+color;
}
return color;
}
</script>
<body>
<table align="center" border="0" width="200"bordercolor="#000099">
<tr id="td" onmouseover="test('td')" onmouseout="test2('td')">
<td>
<font id="tt_td">aaaaaa</font>
</td>
<td>
<font id="tt_td1">bbbb</font>
</td>
</tr>
<tr id="td2" onmouseover="test('td2')" onmouseout="test2('td2')">
<td>
<font id="tt_td2">aaaaaa</font>
</td>
<td>
<font id="tt_td21">bbbb</font>
</td>
</tr>
<tr id="td3" onmouseover="test('td3')" onmouseout="test2('td3')">
<td>
<font id="tt_td3">aaaaaa</font>
</td>
<td>
<font id="tt_td31">bbbb</font>
</td>
</tr>
</table>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<script language="javascript">
<!--
var steplength=32;
var waitlength=39;
function feedin(obj){
obj.red=255
obj.green=255;
obj.blue=255;
if(obj.interval!=null) clearInterval(obj.interval);
var func=function(){
obj.red-=steplength;
obj.green-=steplength;
obj.blue-=steplength;
var color="#"+getColor(obj.red)+getColor(obj.green)+getColor(obj.blue);
obj.style.background=color;
if(obj.red<0||obj.green<0||obj.blue<0){
clearInterval(obj.interval);
}
}
obj.interval=setInterval(func,waitlength);
}function feedout(obj){
obj.red=0
obj.green=0;
obj.blue=0;
if(obj.interval!=null) clearInterval(obj.interval);
var func=function(){
obj.red+=steplength;
obj.green+=steplength;
obj.blue+=steplength;
var color="#"+getColor(obj.red)+getColor(obj.green)+getColor(obj.blue);
obj.style.background=color;
if(obj.red<0||obj.green<0||obj.blue<0){
clearInterval(obj.interval);
}
}
obj.interval=setInterval(func,waitlength);
}function changecolor(stepred,stepgreen,stepblue){
red=red+stepred;
green=green+stepgreen;
blue=blue+stepblue;
return ("#"+getColor(red)+getColor(green)+getColor(blue));
}function getColor(number){ //返回16进制数
if(number<0){
return "00";
}
if(number>255){
return "FF"
}
var color = number.toString(16);
if(color.length==1){
color = "0"+color;
}
return color;
}
-->
</script>
<style type="text/css">
<!--
.shade {
text-align:center;
star : expression(
onmouseover=function(){
feedin(this);
},
onmouseout=function(){
feedout(this);
}
)
}
-->
</style>
<body>
<table align="center" border="0" width="200">
<tr><td class="shade">第一行文字</td></tr>
<tr><td class="shade">第二行文字</td></tr>
<tr><td class="shade">第三行文字</td></tr>
<tr><td class="shade">第四行文字</td></tr>
<tr><td class="shade">第五行文字</td></tr>
<tr><td class="shade">第六行文字</td></tr>
<tr><td class="shade">第七行文字</td></tr>
<tr><td class="shade">第八行文字</td></tr>
<tr><td class="shade">第九行文字</td></tr>
<tr><td class="shade">第十行文字</td></tr>
</table>
</body>
</html>把分给我吧……
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档 </title>
</head>
<script language="javascript">
<!--
var steplength=32;
var waitlength=39;
function feedin(obj){
obj.red=255
obj.green=255;
obj.blue=255;
if(obj.interval!=null) clearInterval(obj.interval);
var func=function(){
obj.red-=steplength;
obj.green-=steplength;
obj.blue-=steplength;
var color="#"+getColor(obj.red)+getColor(obj.green)+getColor(obj.blue);
obj.style.background=color; if(obj.red <0||obj.green <0||obj.blue <0){
clearInterval(obj.interval);
}
}
obj.interval=setInterval(func,waitlength);
} function feedout(obj){
obj.red=0
obj.green=0;
obj.blue=0;
if(obj.interval!=null) clearInterval(obj.interval);
var func=function(){
obj.red+=steplength;
obj.green+=steplength;
obj.blue+=steplength;
var color="#"+getColor(obj.red)+getColor(obj.green)+getColor(obj.blue);
obj.style.background=color; if(obj.red <0||obj.green <0||obj.blue <0){
clearInterval(obj.interval);
}
}
obj.interval=setInterval(func,waitlength);
} function changecolor(stepred,stepgreen,stepblue){
red=red+stepred;
green=green+stepgreen;
blue=blue+stepblue;
return ("#"+getColor(red)+getColor(green)+getColor(blue));
} function getColor(number){ //返回16进制数
if(number <0){
return "00";
}
if(number>255){
return "FF"
}
var color = number.toString(16);
if(color.length==1){
color = "0"+color;
}
return color;
}
-->
</script>
<style type="text/css">
<!--
.shade {
text-align:center;
star : expression(
onmouseover=function(){
feedin(this);
},
onmouseout=function(){
feedout(this);
}
)
}
-->
</style>
<body>
<table align="center" border="0" width="200">
<tr> <td class="shade">第一行文字 </td> </tr>
<tr> <td class="shade">第二行文字 </td> </tr>
<tr> <td class="shade">第三行文字 </td> </tr>
<tr> <td class="shade">第四行文字 </td> </tr>
<tr> <td class="shade">第五行文字 </td> </tr>
<tr> <td class="shade">第六行文字 </td> </tr>
<tr> <td class="shade">第七行文字 </td> </tr>
<tr> <td class="shade">第八行文字 </td> </tr>
<tr> <td class="shade">第九行文字 </td> </tr>
<tr> <td class="shade">第十行文字 </td> </tr>
</table>
</body>
</html>