永发信息网

鼠标移到表格上,表格背景就变颜色并有链接,同时文字也变颜色,离开表格就恢复原来的值?

答案:1  悬赏:40  手机版
解决时间 2021-01-25 06:17
  • 提问者网友:藍了天白赴美
  • 2021-01-24 08:58
<TABLE style="WIDTH: 100px" border=0 cellSpacing=0 cellPadding=0 width=100>
<TBODY>
<TR><A href="#">
<TD style="CURSOR: hand" onmouseover="this.bgColor='#1173CE'" onmouseout="this.bgColor=''" height=25 width=100 align=middle>文字</TD></A></TR></TBODY></TABLE>
在这里怎么添加鼠标移动到表格上文字会变色
最佳答案
  • 五星知识达人网友:长青诗
  • 2021-01-24 09:32
CSS文件: #redtable { color:#FF0000; background-color: #00FFFF; font-size: 20px; font-weight: bold; text-decoration: none; text-align: center; height: 30px; width: 300px; vertical-align: middle; } #redtable a:link{ color: #FF0000; } #redtable a:hover { color:#FFFFFF; background-color: #000000; font-size: 24px; font-weight: normal; text-decoration: underline overline } 网页文件: <head> <script type="text/JavaScript"> <!-- function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_changeProp(objName,x,theProp,theValue) { //v6.0 var obj = MM_findObj(objName); if (obj && (theProp.indexOf("style.")==-1 || obj.style)){ if (theValue == true || theValue == false) eval("obj."+theProp+"="+theValue); else eval("obj."+theProp+"='"+theValue+"'"); } } //--> </script> </head> <link href="css.css" rel="stylesheet" type="text/css"> <body> <div id=redtable onMouseOver="MM_changeProp('redtable','','style.backgroundColor','#3300ff','DIV')" onMouseOut="MM_changeProp('redtable','','style.backgroundColor','#00FFFF','DIV')"> <a href="#">this is a sample</a></div> </body >
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯