DelphiFAQ Home Search:

Show an HTML message box that disappears after 2 seconds

 

commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.

Question:

I need to show an HTML message box that disappears after 2 seconds.
It does not need to be a popup window.

Answer:

Simply display a centered HTML table with a button that says 'please click'.
You can also do an automatic redirect after 3 seconds as shown below.
The sample code uses the setTimeout() function which will call the redirecting javascript function after 3000 milliseconds.

<center>
<table border=4 cellspacing=0 cellpadding=20>
<tr><td bgcolor=silver align=center>

<p>The configuration is being updated.</p>
<p>

<form id=frm1 name=frm1 action="main.cgi" method=post>
<input type=hidden name=action value="detail">
<input type=submit id=btnSubmit name=btnSubmit value="Please click to continue or wait 3 seconds" class=input>
</form>
</p>

<script type=text/javascript language="JavaScript">
<!--
function countdown() {
  document.getElementById('frm1').submit();
}

setTimeout("countdown()", 3000);
document.getElementById('btnSubmit').focus();

-->
</script>

</td></tr></table></center>


Comments:

2007-12-03, 03:46:05
anonymous from Philippines  
just drop by... nice!

 

 

Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option.
 
It seems that you are
from Washington, US .

Info/ Feedback on this

Show city and country
Show country only
Hide my location
Leave your comment here:
Please type in the code:
photo Add a picture:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity. The owner of this web site reserves the right to delete such material.