How to Change the image on mouse over using Jquery


Through the using this code we changed the image on mouse over using Jquery.

Source Code:-


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="JqueryMouseover.aspx.cs"
    Inherits="JqueryMouseover" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>jQuery Change Image on Mouseover</title>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#imagedetails").hover(function () {

                $(this).attr("src", "img/image.jpg");
            }, function () {

                $(this).attr("src", "img/img2.png");
            });
        })
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>

<img id="imagedetails" src="img/img2.png"/>

        <img id="imagedetails" src="/>
    </div>
    </form>
</body>
</html>

Out Put:-







How to Change the image on mouse over using Jquery How to Change the image on mouse over using Jquery Reviewed by NEERAJ SRIVASTAVA on 5:56:00 PM Rating: 5

No comments:

Powered by Blogger.