关于添加css样式的问题

zhaojunwww 2011-10-21 04:23:16
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
#menu {
width:1000px;
margin:0 auto;
height:65px;
background:#000;
font-size:12px;
}
#menu A {
color:#FFF;
text-decoration:none;
}
#menu A:hover {
font-size:16px;
}
#menu SPAN.current {
border-right:#0F0 1px solid;
width:100px;
float:left;
line-height:65px;
COLOR: #fff;
text-align:center;
}
.selected {
background:#C60;

}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(function(){

$("span").click(function () {
$(this).each(function(){
$(this).toggleClass("selected");
});
})





})
</script>
<title>无标题文档</title>
</head>
<body>
<div id="menu"> <a href=""><span class="current">首页</span></a><a href=""><span class="current">关于</span></a><a href=""><span class="current">招聘</span></a></div>
</body>
</html>

问题:点击后为何背景没有变色?
...全文
102 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
liangws 2011-10-21
  • 打赏
  • 举报
回复
如果要跳转的话,要进入页面的时候判断是哪个导航条,直接修改样式。。
zell419 2011-10-21
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 zhaojunwww 的回复:]

引用 1 楼 zell419 的回复:

HTML code
<a href="javascript:;"><span class="current">首页</span></a>

页面刷新了 。 ~


页面加上超链接就不行了 比如:
<div id="menu"> <a href="index.html"><span class="current">首页</span></……
[/Quote]
都链接过去了 当然不行了 。
zhaojunwww 2011-10-21
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 zell419 的回复:]

HTML code
<a href="javascript:;"><span class="current">首页</span></a>

页面刷新了 。 ~
[/Quote]

页面加上超链接就不行了 比如:
<div id="menu"> <a href="index.html"><span class="current">首页</span></a><a href="about.html"><span class="current">关于</span></a><a href="zp.html"><span class="current">招聘</span></a></div>
zell419 2011-10-21
  • 打赏
  • 举报
回复
<a href="javascript:;"><span class="current">首页</span></a>

页面刷新了 。 ~

87,989

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧