<div>
私はこのコードを持っており、閉じるボタンをクリックするだけでなく、その外側をクリックしてこのポップアップを閉じたいと思っています。
どうやってやるの?
<script language="JavaScript">
<!--
function displayPopup(alert_MSG) {
var theDetail = document.getElementById(alert_MSG);
theDetail.style.display="block";
}
function closePopup(alert_MSG) {
var theDetail = document.getElementById(alert_MSG);
if (theDetail.style.display=="block") {
theDetail.style.display="none";
}
}
-->
</script>
HTML リンクは次のとおりです。
<a href="javascript:displayPopup(<?=$id_pic?>)">open div here</a>
そして、ここに私のポップアップがあります:
<div id="<?=$id_pic?>" class="myPopup" style="display:none;">
<div class="closeButton">
<a href="javascript:closePopup(<?=$id_pic?>)">Close</a>
</div>
Popup content here
</div>