Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Timed alert box pop up for website? [duplicate]

For my website I would like an alert box message to appear 4 seconds after the page is opened. I cant figure out how to do this as the timed function works if a button is clicked but I would like the alert box to pop up automatically withoutt any user input/button and then shut when the user clicks "okay"...

Any ideas or posts related to this topic would be great help!

Thanks

like image 248
BLS93 Avatar asked Dec 11 '22 14:12

BLS93


1 Answers

<script type = "text/javascript">
window.onload=function(){setTimeout(showPopup,4000)};

function showPopup()
{
   //write functionality for the code here
}
</script>
like image 67
Harsha Venkatram Avatar answered Dec 25 '22 12:12

Harsha Venkatram