954,560 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Change Cursor Type & BackColor

I want to change cursor type & backcolor when mouse moves over a td,Suppose I want to chnage the cursor to Hand, & backcolor to Blue on mouse move, & on mouse leave i want to change the cursor to default..How to do it?????????

mansi sharma
Junior Poster in Training
75 posts since Apr 2008
Reputation Points: 17
Solved Threads: 0
 

The below code should solve the problem...

<td                
onmouseover="style.backgroundColor='blue'"                 onmouseout="style.backgroundColor=''"                         style="cursor:pointer;">
        hi
  </td>
Dhaneshnm
Junior Poster in Training
52 posts since Mar 2009
Reputation Points: 22
Solved Threads: 7
 

Thx...
Thru JS

<script type ="text/javascript"  >
    
    function onMouseMove()
    {
    document.getElementById("1").style.backgroundColor ="skyblue";  
    document.body.style.cursor = 'hand';
    }
    
    function onMouseLeave()
    {
    document.getElementById("1").style.backgroundColor ="";
    document.body.style.cursor = "default";
    }
    </script>

<td  id="1" style="width: 98px; height: 46px;" onMouseOver="onMouseMove()" onMouseOut="onMouseLeave()">
                    </td>
mansi sharma
Junior Poster in Training
75 posts since Apr 2008
Reputation Points: 17
Solved Threads: 0
 

Better!!!!!!!!!!!

Dhaneshnm
Junior Poster in Training
52 posts since Mar 2009
Reputation Points: 22
Solved Threads: 7
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You