Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
hi,
i want know the html code for displaying image by clicking a button in browser.

Thanks
Posted
Updated 20-Mar-20 0:33am

Please share the your code firstly .. I guess you want like this :

XML
<head><title>Image Display Test
    </title>
    <script type="text/javascript">
<!--
    function showImage(){
        document.getElementById('loadingImage').style.visibility="visible";
    }

    -->

    </script>
    </head>
<body>
    <input type="button" value="Show Button" onclick="showImage();"/>
    <img id="loadingImage" src="yourimage.gif" style="visibility:hidden"/>

</body>


Thanks,
Ambesha
 
Share this answer
 
v2
Comments
sandeepatil 17-Oct-12 1:39am    
thank you
Ambesha 17-Oct-12 1:45am    
welcome freind, please rate the solution if it comes timely and relevnt for you.
Member 14697373 22-Dec-19 18:23pm    
Thank you!
<html>
<head>
  <title>click</title>
  <style>
           #image{
                display:none;
      </style>
</head>
  <body>
      <div>
           <img src="medical reports.jpg" id="image" alt="Medical" />
      </div>

       <button type="button" onclick="imageShow()">ClickMe</button>

       <script>
             function imageShow(){
                    document.getElementById('image').style.display = "block";       
                    }
        </script>
</body>
</html>
 
Share this answer
 
Comments
Maciej Los 20-Mar-20 6:42am    
Do you think that OP is interested in answer after almost 8 years?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900