部分代码如下:
<table width="93%" border="0" align="center" cellpadding="0" cellspacing="0" background="barbg.gif">
<tr>
<td width="4"><img src="images/barleft.png" width="4" height="31"></td>
<td width="25%" align="center"><a href="system.htm" class="topmenu">System</a></td>
<td width="1"><img src="images/barseperator.gif" width="1" height="31"></td>
<td width="25%" align="center"><a href="wireless.htm" class="topmenu">Wireless</a></td>
<td width="1"><img src="images/barseperator.gif" width="1" height="31"></td>
<td width="25%" align="center"><a href="status.htm" class="topmenu">Status</a></td>
<td width="1"><img src="images/barseperator.gif" width="1" height="31"></td>
<td width="25%" align="center"><a href="passwd.htm" class="topmenu">Password</a></td>
<td width="4"><img src="images/barright.png" width="4" height="31"></td>
</tr>
</table>css 如下:
.topmenu:link {
font-family: Arial, Helvetica, Geneva, Swiss, SunSans-Regular, sans-serif;
font-size: 15px;
font-weight: bold;
color: #FFFFFF;
text-decoration: none;
}
.topmenu:visited {
font-family: Arial, Helvetica, Geneva, Swiss, SunSans-Regular, sans-serif;
font-size: 15px;
font-weight: bold;
color: #FFFFFF;
text-decoration: none;
}
.topmenu:hover {
font-family: Arial, Helvetica, Geneva, Swiss, SunSans-Regular, sans-serif;
font-size: 15px;
font-weight: bold;
color: #FFFFFF;
text-decoration: underline;
}我想实现的功能是:当我点击一个选项后(例如 system), 该超链接所在的td块背景变成一个图片(select.gif),当选项没有被选中的时候,选项保持原来背景(barbg.gif)。请问,如何实现,是否用CSS就可以,还是说要加入javascripts, 谢谢~
<table width="93%" border="0" align="center" cellpadding="0" cellspacing="0" background="barbg.gif">
<tr>
<td width="4"><img src="images/barleft.png" width="4" height="31"></td>
<td width="25%" align="center"><a href="system.htm" class="topmenu">System</a></td>
<td width="1"><img src="images/barseperator.gif" width="1" height="31"></td>
<td width="25%" align="center"><a href="wireless.htm" class="topmenu">Wireless</a></td>
<td width="1"><img src="images/barseperator.gif" width="1" height="31"></td>
<td width="25%" align="center"><a href="status.htm" class="topmenu">Status</a></td>
<td width="1"><img src="images/barseperator.gif" width="1" height="31"></td>
<td width="25%" align="center"><a href="passwd.htm" class="topmenu">Password</a></td>
<td width="4"><img src="images/barright.png" width="4" height="31"></td>
</tr>
</table>css 如下:
.topmenu:link {
font-family: Arial, Helvetica, Geneva, Swiss, SunSans-Regular, sans-serif;
font-size: 15px;
font-weight: bold;
color: #FFFFFF;
text-decoration: none;
}
.topmenu:visited {
font-family: Arial, Helvetica, Geneva, Swiss, SunSans-Regular, sans-serif;
font-size: 15px;
font-weight: bold;
color: #FFFFFF;
text-decoration: none;
}
.topmenu:hover {
font-family: Arial, Helvetica, Geneva, Swiss, SunSans-Regular, sans-serif;
font-size: 15px;
font-weight: bold;
color: #FFFFFF;
text-decoration: underline;
}我想实现的功能是:当我点击一个选项后(例如 system), 该超链接所在的td块背景变成一个图片(select.gif),当选项没有被选中的时候,选项保持原来背景(barbg.gif)。请问,如何实现,是否用CSS就可以,还是说要加入javascripts, 谢谢~
解决方案 »
- struts2的action到result转发的配置问题。
- 整合ssh2时出现 404 - There is no Action mapped for namespace / and action name login.
- Spring中dataSource注入时把dataSource定义成static会有什么后果?
- 使用tomcat数据源比jdbc直接连接快吗,我测试的怎么速度都一样呢 是不是那里写错了 请指教!!
- 请问在查询返回结果的过程中,不能再进行别的查询吗
- java 数据库插入失败和成功的问题
- 为什么重新编译smartupload.java的时候总是提示cannot resolve symbol??急!!
- JspException在哪个包中?
- 第一次使用Hessian搭建简单Web应用,Tomcat长时间没有响应
- 我的TOMCAT的8080端口被占用了,怎么办?
- 求助大家一个关于jstl的问题
- sql语句中case的写法问题
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<style>
.topmenu:link {
font-family: Arial, Helvetica, Geneva, Swiss, SunSans-Regular, sans-serif;
font-size: 15px;
font-weight: bold;
color: #FFFFFF;
text-decoration: none;
}
.topmenu:visited {
font-family: Arial, Helvetica, Geneva, Swiss, SunSans-Regular, sans-serif;
font-size: 15px;
font-weight: bold;
color: #FFFFFF;
text-decoration: none;
}
.topmenu:hover {
font-family: Arial, Helvetica, Geneva, Swiss, SunSans-Regular, sans-serif;
font-size: 15px;
font-weight: bold;
color: #FFFFFF;
text-decoration: underline;
}
</style>
<script>
var lastClickLink;
function clickLink(obj){
if(lastClickLink){
lastClickLink.parentNode.style.cssText="background:url(barbg.gif);";
}
obj.parentNode.style.cssText="background:url(select.gif);";
lastClickLink=obj;
}
</script>
<BODY>
<table width="93%" border="1" align="center" cellpadding="0" cellspacing="0" background="barbg.gif">
<tr>
<td width="4"> <img src="images/barleft.png" width="4" height="31"> </td>
<td width="25%" align="center"> <a href="system.htm" onclick="clickLink(this);" class="topmenu">System </a>dd </td>
<td width="1"> <img src="images/barseperator.gif" width="1" height="31"> </td>
<td width="25%" align="center"> <a href="wireless.htm" onclick="clickLink(this);" class="topmenu">Wireless </a> </td>
<td width="1"> <img src="images/barseperator.gif" width="1" height="31"> </td>
<td width="25%" align="center"> <a href="status.htm" onclick="clickLink(this);" class="topmenu">Status </a> </td>
<td width="1"> <img src="images/barseperator.gif" width="1" height="31"> </td>
<td width="25%" align="center"> <a href="passwd.htm" onclick="clickLink(this);" class="topmenu">Password </a> </td>
<td width="4"> <img src="images/barright.png" width="4" height="31"> </td>
</tr>
</table>
</BODY>
</HTML>