Monday, 28 May 2012

Image Mouse Hover in asp.net


To show image in particular div when mouse hover on the image using asp.net

  Script

<script type="text/javascript" language="javascript">

        function ShowToolTip(con) {
            document.getElementById("div_img").style.visibility = "visible";
            document.getElementById("img_tool").src = con.src;
            document.getElementById("div_img").style.left = event.clientX;
            document.getElementById("div_img").style.top = event.clientY;
            document.getElementById("div_img").style.zIndex = "0";
        }

        function hideToolTip() {
            document.getElementById("div_img").style.visibility = "hidden";
        }

    </script>

Note:write this script in head tag


Design:


<form id="form1" runat="server">
    <div>
        <asp:Image ID="Image1" runat="server" ImageUrl="~/Images/3.jpg" Height="50px" Width="50px"
            onmouseover="ShowToolTip(this);" onmouseout="hideToolTip();" />
            <br />
            <br />
        <div id="div_img" style="height: 300px; width: 300px; border: solid 1px black; position: absolute;
            visibility: hidden;">
            <img id="img_tool" height="100%" width="100%" />
        </div>
    </div>
    </form>

Final Output:




Related Posts:

  • Culture info in RadDateTime Picker In this example we can give culture info for localization in RadDatetimePicker. for this below example u can get different localizations according to their country. it is one of the property in RadDateTimePicke… Read More
  • Word document in iframe This is screen shot for iframe.Here In the below Screenshot iframe viewing the word document in the form of html. so i am giving html to the Iframe src. Iframe can view excel,csv,pdf,text file… Read More
  • Replace characters in javascript In server side we have "Replace" method to replace the characters in a string but on javascript replace method will be not useful in certain cases instead of that we can do for loop to replace the particular characters and g… Read More
  • Word Documents and Excel Documents in IFRAME In this below example we are converting word OR excel document to HTML. In this case we are converting and giving converted HTML file as ""src"" to ""iframe"". Step By Step Procedure : 1)First step is create one… Read More
  • Image Mouse Hover in asp.net To show image in particular div when mouse hover on the image using asp.net   Script <script type="text/javascript" language="javascript">         function ShowToolTip(con) {   &n… Read More

0 comments:

Post a Comment