I have page php & I have link to download file i need code show img one time OR onclick Link (Download File) Hide img (nof1.gif)
Now I am replacing the image(nof1.gif) in an empty img (empty_img.png) But when reloading the page the images Again
The idea to show the image only once
<a href="<?php echo base_url($l['admin_file']); ?>" target="_blank" >Download File </a>
<img id="my_images" src="nof1.gif" style="width:40px;height:30px"
onclick="this.src='empty_img.png'; "
>
or see the code There is an error and I do not know the solution!!!
<html>
<button onclick="hideImage()'"> Remove img </button>
<img id="my_images" src="http://karachiairport.com.pk/images/data-section/airline/24-11.png">
<script>
document.addEventListener('DOMContentLoaded', function() {
// If cookie exist
if (document.cookie.indexOf('image_clicked') > -1) {
document.getElementById("my_images").src="http://www.1dmag.com/all_asset/img/no-image.png";
}
function hideImage() {
document.getElementById("my_images").src="http://www.1dmag.com/all_asset/img/no-image.png";
document.cookie = "image_clicked=true";
}
});
</script>
</div>