动态绑定的导航条的问题 默认一个背景图片,鼠标移动上去变色,点击也变色其他的变回默认我现在写的方法是
#leftMune ul li a:link
{
background: url(../../AdvertisementImg/DingZhiSiYouYun/Button2.jpg);
}
#leftMune ul li a:hover
{
color: White;
background: url(../../AdvertisementImg/DingZhiSiYouYun/Button1.jpg);
font-weight: bold;
}
#leftMune ul li a:active
{
color: White;
background: url(../../AdvertisementImg/DingZhiSiYouYun/Button1.jpg);
font-weight: bold;
}这样的方法可是实现功能 但是问题是 当点击一个a变迁 设定其背景后,,鼠标移开点击其他地方, 那刚刚设置的颜色
又变了回来 改怎么解决这一问题
#leftMune ul li a:link
{
background: url(../../AdvertisementImg/DingZhiSiYouYun/Button2.jpg);
}
#leftMune ul li a:hover
{
color: White;
background: url(../../AdvertisementImg/DingZhiSiYouYun/Button1.jpg);
font-weight: bold;
}
#leftMune ul li a:active
{
color: White;
background: url(../../AdvertisementImg/DingZhiSiYouYun/Button1.jpg);
font-weight: bold;
}这样的方法可是实现功能 但是问题是 当点击一个a变迁 设定其背景后,,鼠标移开点击其他地方, 那刚刚设置的颜色
又变了回来 改怎么解决这一问题
解决方案 »
- 点击注销登陆按钮没法清除cookie,但退出浏览器就可以,求解决方法?
- asp.net权限问题,我是新手,前辈们别笑我啊。。。
- 发送的请求只有第一次执行了
- 关于两行代码的意思,从开始学就没弄明白
- 请教vb.net中class内定义的const类型成员变量和shared类型成员变量的区别
- 关于数据绑定显示'没有查询到相关记录'的问题
- 求助,我生成FTP链接地址点击后会变成乱码,怎么能点击链接自动弹出下载呢
- 怎么判断一棵treeview的nodes中是否有节点存在呢?
- 发布问题:asp.net和sql server做的网站,如何发布到外网
- 收集asp.net fan的msn passport email地址我的是[email protected]全天在线(加入者皆有分)
- a标签调用后台方法
- 大家帮忙给我看一个思路设计,用.net、php开发都可以
可以把状态存入cookies或者隐藏域,页面加载时用js取出状态给超链接样式。
<style type="text/css">
#news
{
background: url(../../AdvertisementImg/DingZhiSiYouYun/Button1.jpg);
color:White; font-weight:bold
}
#news1
{
background: url(../../AdvertisementImg/DingZhiSiYouYun/Button2.jpg);
}
</style> <script type="text/javascript">
$(document).ready(function () {
$flag = $("#content ul li a") //获取导航栏中所有的a标签
$flag.first().attr("id", "news");//获取导航栏中第一个a标签 并切给予设置一个id=new
$("#content ul li a:not([id='news'])").attr("id","news1");//获取导航栏中id!=new的所有标签 并切给予设置一个id=new1
$flag.click(function () {
$("#content ul li a:not(attr='click')").attr("id","news1");//点击一个标签的时侯,就设置这个标签的id为new 把其他的设置为new1 从而达到变换的效果
$(this).attr("id", "news")
}
);
})
</script>
html略 就是一些 li 里面套点a标签
效果就是 点击一个a标签 背景色变为指定的,其他没被点击的还原默认颜色