Thank You Alert
Confirm actions or welcome visitors. This simple script triggers a system dialog box to say "Thank You" after a form submission or page load.
Copy the Script
<script>
// 1. Basic OnLoad Alert
window.onload = function() {
alert("Thank you for visiting our site!");
}
// 2. Delayed Alert (Non-blocking for 2 seconds)
setTimeout(function() {
alert("Thank you for waiting!");
}, 2000);
</script>
Frequently Asked Questions
Yes. By wrapping the alert in a JavaScript 'setTimeout' function, you can make the message appear after a few seconds instead of immediately.
Yes. The standard 'alert()' function pauses the browser's execution thread, meaning the rest of the page might not finish rendering until the user clicks 'OK'.
To avoid pausing the page, consider using a custom HTML modal or a 'toast' notification library instead of the native alert.