Home > ASP.Net, Javascript > JavaScript to Maximize/Restore HTML image

JavaScript to Maximize/Restore HTML image


Hi

try this example to Maximize and Restore HTML image on click on image

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <style type="text/css">
        .image {width:187px; height:224px; border: 1px solid #000000}
    </style>
    <script type="text/javascript">
        var restored = true        
        function MaximizeRestore()
        {
            if (restored == true)
            {  
                document.getElementById("testimage").style.width="374";
                document.getElementById("testimage").style.height="448";               
                restored = false;
            }
            else
            {
                document.getElementById("testimage").style.width="187";
                document.getElementById("testimage").style.height="224";               
                restored = true;
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <img id="testimage" src="images/image.jpg" alt="testimage" class="image" onclick="MaximizeRestore()" />   
    </div>
    </form>
</body>
</html>

Good Luck

Advertisements
Categories: ASP.Net, Javascript
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: