hi friends.. i wan to change the color when i clicked on the particular link in asp.net. if i click on another link means previous link should return to unvisited color..
please help me..

What have you tried? Please post your code.

In css, set styles for:

a:link    {color:xx;}
a:visited {color:xx;}
a:hover   {color:xx;}
a:active  {color:xx;}

a:link {color:xx;}
a:visited {color:xx;}
a:hover {color:xx;}
a:active {color:xx;}

I have tried this code also.. but it wil work for onmouseover,onmouseout and onclick also..
but once i clicked on that link.. it wil change the color only that time.. if i dropped to click means it wont change color..
i wan to show in which page i am there by changing the color not only onmouseover..

Oh, I think I know what you're trying to do.

Usually it's done with a class that highlights the lates link (often a background color, border, etc.).

Then in javascript onclick you loop through all the links and remove that class, then add the class to the link that was just clicked.

Something like that?

<td>
<a href="home.aspx">Home</a></td>
like this About,Services links are there in menu bar. now all links have black color. if i click on home link means that link text(home) should change to white color not only onmouseover.. i can move mouse any where in that home page.. that white color should be visible. if i click About link this link should change to white color. home link should return to black color..
like this i want.. i am beginner to asp.net. so help me..

still i did not get answer.. no one can help me?

Finally i got answer.

<script type="text/javascript">
window.onload = initall;
var URL = location.href;
function initall() {
switch (true) {
case URL.indexOf("page1.aspx") > -1: document.getElementById('link1').style.color = "red"; break;
case URL.indexOf("page2.aspx") > -1: document.getElementById('link2').style.color = "red"; break;
case URL.indexOf("page3.aspx") > -1: document.getElementById('link3').style.color = "red"; break;
case URL.indexOf("page4.aspx") > -1: document.getElementById('link4').style.color = "red"; break;
case URL.indexOf("page5.aspx") > -1: document.getElementById('link5').style.color = "red"; break;
}
}
</script>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.