how to use in onmouseover and onmouseout property for a ASP.Net2.0 control by using javascript

Suppose I want to show and hide an Image by taking and removing mouse over another control like Image, Label.... by using JavaScript only

I suppose you could just point the onmouseover over property to a function which sets the visbility of the object and loke wise for onmouseout the functions would look something like:

function hideImage(control) { = 'hidden';

function showImage(control) { = 'visible';

the properties in the control should look something like: OnMouseOver = "hideImage(this)" OnMouseOut = "showImage(this)"

I haven't tested this though but something like it should work

attribute.add(....) function is for client side only.. and it works fine with grid views...
but in case of asp:buttons i am also having trouble..

This may not be the proper way,but serves the purpose.
When user mouseover on button it displays the image and when on mouseout hides the image.


<script  type="text/javascript">
 function ShowImage()
     value.height=15; ='visible'
 function HideImage()
      value=document.getElementById("Image1") ='hidden'

 <asp:Button ID="btn" runat="server" Text="Button" />
<img id="Image1" src="" alt="image" width="0" height="0" />


btn.Attributes.Add("onmouseover", "ShowImage()");
 btn.Attributes.Add("onmouseout", "HideImage()");

Good Luck


This question has already been answered. Start a new discussion instead.