Click here to Skip to main content
16,020,990 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i used text boxes and one button on my .aspx page and i send the email of the textbox data on the button click event.Now i want to show an image when i click on the button using java script so please tell me how can show an image on button click event ?
Posted
Updated 26-Jun-12 19:42pm
v2

1 solution

JavaScript
<script language="javascript">
    function displayImage() {
        document.getElementById('img').style.display = 'block';
    }
</script>

ASP.NET
<asp:button id="button1" runat="server" onclientclick="displayImage(); return false;" text="view image" />
     <asp:image id="img" runat="server" imageurl="~/loadingAnimation.gif" style="display:none;" />


You can also refer below links:
http://forums.asp.net/t/1681635.aspx/1?to+show+image+on+button+click+using+javascript[^]
http://stackoverflow.com/questions/1999071/show-hide-image-on-click[^]
 
Share this answer
 
v3

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