当用户单击母版页中的链接时,如何更改链接的背景颜色

当用户单击母版页中的链接时,如何更改链接的背景颜色

问题描述:

我创建了一个导航在顶部的网站。

导航我有:家,关于我们,联系我们,...

我想要的时候用户点击任何关于我们的链接,背景颜色

的链接已更改,我正在使用我的网站的母版页和这项工作(更改背景颜色)

i used jquery ,但不幸的是因为在母版页中发生了page_load,jquery的效果被浪费了。

(它发生了一秒钟而浪费)

有人可以帮我吗?

请原谅我的英语不好。

i create a site which has a Navigation in top.
in navigation I have : home , about us,contact us , ...
I want that when user click on any link like about us , background color
of link changed, I am using master page for my site and for this work(change background color)
i used jquery ,but unfortunately because occurring page_load in master page, effect of jquery wasted.
(it occurred for a second and waste)
can anyone help me?
excuse me for my poor English.




如果你想改变链接的背景颜色当你点击时,你可以使用一些服务器端逻辑,如果jquery或css不适合你



在你的关于我们或任何页面的页面加载事件中尝试这个>


Hi
if u want to change the background color of link when u clicked, u can use some server side logic if jquery or css is not working for you

try this in your about us's or any page's pageload event

HtmlAnchor link = (HtmlAnchor)(this.Master).FindControl("controlid");
                link.Style.Add("background-color", "#ffffff");





链接的背景颜色将坚持到你移动到另一页。



注意:此代码用于html锚标记。使用ur html标记或asp控件放置



Background color of link will persist until u move to another page.

Note:This code is for html anchor tag.Replace with ur html tag or asp control