Last Reply on Apr 16, 2012 03:33 AM By Mudassar

Views: 322   Replies: 1  Answers: 1
Joined: Jan 30, 2012 12:39 AM
Location:  
tehran
Iran  Iran
Asked: 328

hi 

I have image button in my page i set an image for this control i want when mouse go over on my imagebutton my imagebutton picture change  how i can do it?

 

Neda


Joined: Nov 11, 2011 05:52 PM
Location:  
India 
Answered: 2721
Attempted: 3564
0

Try this

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat = "server">
    <title></title>
    <script type = "text/javascript">
        window.onload = function () {
            var img1 = '<%=ResolveUrl("~/Images/asc.gif") %>';
            var img2 = '<%=ResolveUrl("~/Images/desc.gif") %>';
            var img = document.getElementById("<%= ImageButton1.ClientID%>");
            img.src = img1;
            img.onmouseover = function () {
                this.src = img2;
            };
            img.onmouseout = function () {
                this.src = img1;
            };
        };
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ImageButton ID="ImageButton1" runat="server" />
    </form>
</body>
</html>

 

MVP ASP.Net

© 2013 www.aspforums.net All rights reserved. Powered by Excelasoft Solutions.  Excelasoft Solutions

Disclaimer: This site is started with intent to serve the ASP.Net Community by providing forums (question-answer) site where people can help each other. The content posted here is free for public and is the content of its poster. The site does not provide any warranties for the posted content. If you feel any content is violating any terms please contact.
Google+ | FaceBook | Glossary
Google