Click here to Skip to main content
15,904,416 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi....
i want change the color when i put the corsor on specific field or button
can any one tell me how to write code for it


advance in thanx...
Posted

C#
//In web application
yourlabelid.Attributes.Add("onmousemove","abc();")

JavaScript
<script type="text/javascript" language="javascript"&gt;
        function abc() {
            var v = document.getElementById(<'%=yourlabelid.ClientID%'>);
            v.style.backgroundColor = "red";
        }
    </script>

C#
//In windows use MouseHover event of label
private void panel1_MouseHover(object sender, System.EventArgs e)
       {

           yourlabelname.ForeColor=SystemColors.ControlText;
       }
 
Share this answer
 
v5
Comments
mahesh202 7-Sep-12 0:51am    
send the javascript code please
Sangramsingh Pawar 7-Sep-12 3:06am    
I have alredy included javascript code in my answer
Hi Mahesh,

You can use javascript onmouseover event for your control. find the example on following URL:

http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onmouseover[^]
 
Share this answer
 
v2

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