鼠标移到表格上,表格背景就变颜色,同时文字也变颜色,离开表格就恢复原来的值?这样的CSS怎么搞??
鼠标移到表格上,表格背景就变颜色,同时文字也变颜色,离开表格就恢复原来的值?这样的CSS怎么搞??谢谢...
鼠标移到表格上,表格背景就变颜色,同时文字也变颜色,
离开表格就恢复原来的值?
这样的CSS怎么搞??
谢谢 展开
离开表格就恢复原来的值?
这样的CSS怎么搞??
谢谢 展开
展开全部
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 >
#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 >
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询