Click here to Skip to main content
15,747,766 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to change word color with underline in link button using css when mouse over.

Actually i did in design time for link button ,
font-family=" Arial"
    font-size=" 12px"
    color=" black"

so it look like word not as link button(this is my need).i have 5 link buttons all are same properties like javascript for each link button onclienclick event i will change that color to "blue"
OnClientClick="return AddDept_ClientClick()"

and in javascript
document.getElementById("ctl00_ContentPlaceHolder1_lnkAddDept").style.color = "Blue"
           document.getElementById("ctl00_ContentPlaceHolder1_lnkAddUser").style.color = "black"
           document.getElementById("ctl00_ContentPlaceHolder1_lnkImpADUser").style.color = "black"
           document.getElementById("ctl00_ContentPlaceHolder1_lnkImpUserList").style.color = "black"
           document.getElementById("ctl00_ContentPlaceHolder1_lnkExpUserList").style.color = "black"

bcz all link button related with each other.(i.e) if i click one link button ,that link button chnage to blue color and other four chnage to black color,so only user know which link button is clicked.and it will work fine.

But my need is ,i need to implement mouse hover concept in link button.
i mean if user hover the link need to change color with underline word,if mouse out it stay in default style.

if i add css for mouse over
          color: red;


1.underline word not work.
2.if i mouse hover for all link button color only chnaged,if i click any link button other get black color using javascript this is also my need,but if i try to mouser hover again it not work,bcz in javascript i will give black color for other link button.
if i remove javascript it will work,but i need to chnage color of link button when i click another link button.

pls reply me how to solve this proble ?

Updated 23-Oct-13 19:05pm

1 solution

you have no need to used document.getElementById specially for each saparate contral of the page, i would like to suggest you that if you have limited no of contrals then you could use the saparate stylesheet code for each one.
What you say?!
Share this answer
Aravindba 25-Oct-13 5:41am    
thank u for ur reply,actually above in solved,pls see this link

and try this sample in IE8,chrome and mozila.only it work in ie 8 other browser not work.if u use below sample code u can face the problem.what i am write in sample,two hyper link in not enabled and other two hyper link enabled form server side code ,i can click not enabled hyper link and page reacts in chrome and mozilz.

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