农村2间2层楼房效果图:css相关问题

来源:百度文库 编辑:神马品牌网 时间:2024/05/05 15:07:50
onMouseOver="this.style.background='url(tit-2.gif)'" onMouseOut="this.style.background='url(tit-1.gif)'"

请问如果我把CSS自定义名后写在<style type="text/css">
.da {background:url(tit-2.gif);}
</style> 里面
那我在onMouseOver后面应该怎样引用这个名字达到同样的效果?
<td width="61"onMouseOver=this.classname="bg1" onMouseOut=this.classname="bg2" >
或者onMouseOver="this.classname='da'"
onMouseOut="this.classname='另一个CSS名称'"
都不起作用
我定义的是单元格背景图片变化 会不会与这个有关?

css文件是外部调用 是这样写的 .bg1 { background-image:url(tit-2.gif);}
.bg2 { background-image:url(tit-1.gif);}

两为兄台~多谢了~要不这样吧 间间单单做一个成功实现名称调用的页面 把代码复制上来怎么样?
多谢了

这个“this.classname”的“classname”是区分大小写的
不能是“classname”而是“className”(这个“N”必须要大写)

下面是个完整的(其实也用不着了,只要那个“N”大写就行了):
<html>
<head>
<title>测试CSS</title>
<style type="text/css">
.a{background:url("http://www.google.com/intl/zh-CN_ALL/images/logo.gif");}
.b{background:url("http://www.baidu.com/img/logo.gif");}
</style>
</head>
<body>
<br>
<table width="500" border="1" bordercolor="#FF0000" align="center">
<tr>
<td height="500" align="center" onmouseover="this.className='a'" onMouseOut="this.className='b'">
<b>鼠标放上来看看</b>
</td>
</tr>
</table>
</body>
</html>

<style type="text/css">
.a{background:url("tit-2.gif");}
.b{background:url("tit-1.gif");}
</style>

onMouseOver=this.classname="a"; onMouseOut=this.classname="b";