Thursday 29 November 2012

Image Zoom In and Zoom Out using JavaScript in Asp.net.


In the previous I had explained ’ Image Zoom In and Zoom outusing Jquery in Asp.Net’. In this post I have explaind  ‘Image Zoom In and Zoom out using Simple JavaScript  code in Asp.Net’.

Code For Design Page:-

<!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 runat="server">
    <title>Image Zoom In and Zoom Out using JavaScript</title>
    <script language="javascript" type="text/javascript">
        var nw, nh, oh, ow;
        function zoomImage(IWideSamll, IHighSamll, IWideLarge, IHighLarge, whichImage) {
            ow = whichImage.style.width;
            oh = whichImage.style.height;
            if ((ow == IWideLarge) || (oh == IHighLarge)) {
                nw = IWideSamll;
                nh = IHighSamll;
            }
            else {
                nw = IWideLarge;
                nh = IHighLarge;
            }
            whichImage.style.width = nw;
            whichImage.style.height = nh;
        }
    </script>
  
</head>
<body>
    <form id="form1" runat="server">
    <div align="center">
        <img alt="" src="1.jpg" width="100" height="100" onmouseover="zoomImage('400px','200px','400px','200px',this);" onmouseout="zoomImage('50px','70px','50px','70px',this)" />
        
    </div>
    </form>
</body>
</html>

Debug the code and run.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.