Click here to Skip to main content
15,889,442 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Updated 2-Apr-15 9:41am
v3
Comments
Maciej Los 1-Apr-15 16:01pm    
Use css - on mouse click "event" ;)
Arkadeep De 2-Apr-15 15:41pm    
what jquery code you are writing?? can u share those?
Suvendu Shekhar Giri 3-Apr-15 0:29am    
Though it sounds different but may be you are looking for this -
CSS :hover Selector

1 solution

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");


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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900