locked
send server control id to javascript function RRS feed

  • Question

  • Hi

    <img alt="" id="Image1" runat="server" onmouseover="ChangeImage()" onmouseout="ReverseImage()"  />
    <img alt="" id="Image2" runat="server" onmouseover="ChangeImage()" onmouseout="ReverseImage()"  />
    <img alt="" id="Image3" runat="server" onmouseover="ChangeImage()" onmouseout="ReverseImage()"  />

    I need to pass image id as a parameter to javascript function.how can i

    give me needfull
    Tuesday, March 9, 2010 6:56 AM

All replies

  • Hi,

    pass 'this' as a parameter the function which points the image you hover the mouse.

    this object will point to the image on which the mouse is over, this object will have the id property which gives you the id of the image.

    i.e in onmouseover="ChangeImage(this);"

     

    OR

    you can access the id of the server control in java script as <%= Control.ClientID %> which will give you the id of the control.

    Tuesday, May 4, 2010 7:24 AM