如何通过单击图像隐藏div [英] how to hide div by clicking on image
本文介绍了如何通过单击图像隐藏div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个div标签
i have one div tag
<div id="notification" runat="server" visible="false">
<div id="success" class="success">
<img src="Styles/css/images/success.png" alt=""/>
Success: You have added product in your
shopping cart !
<img class="close" id="imgCloseNotification" alt="" src="Styles/css/images/close.png" önclick="hideNotifacation();"/>
</div>
</div>
function hideNotification() {
document.getElementById(''notification'').style.display = "none";
}
现在我想当我单击具有id ="imgCloseNotification"的图像时,div应该关闭我已经编写了上面代码中给出的javascript函数,但是它不起作用...建议我如何做到这一点?
now i want when i click on image having id="imgCloseNotification" the div should be close i have written javascript function given in above code but it is not working... suggest me how to do this?
推荐答案
尝试此..工作正常
Try this..working fine
<div id="notification" runat="server" visible="false">
<div id="success" class="success">
<img src="Styles/css/images/success.png" alt="" />
Success: You have added product in your
shopping cart !
<img class="close" id="imgCloseNotification" alt="" src="Styles/css/images/close.png" önclick="javascript:hideNotifacation();" />
</div>
</div>
谢谢
Thanks
这篇关于如何通过单击图像隐藏div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文