如何在按钮单击事件中显示图像? [英] How can show an image on button click event?

查看:72
本文介绍了如何在按钮单击事件中显示图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在.aspx页面上使用了文本框和一个按钮,并在按钮单击事件中发送了文本框数据的电子邮件.现在,我想在使用Java脚本单击按钮时显示图像,所以请告诉我如何在按钮单击事件上显示图像?

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 ?

推荐答案

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


<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;" />



您还可以参考以下链接:
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 [ ^ ]



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[^]


这篇关于如何在按钮单击事件中显示图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆