PDA

View Full Version : Timed Alert Display


rsci
10-25-2002, 01:00 PM
Is it possible to set a time limit on an alert? So that after displaying say for 10 seconds, the alert goes away?

Thanks,

chrismiceli
10-25-2002, 01:29 PM
i think this might work


function hello() {
var test = alert("hi");
setTimout("return true", "5000");
}
<input type="button" onClick="hello">

rsci
10-25-2002, 02:49 PM
Nope, no go. I also tried a window.click() instead of return true.

beetle
10-25-2002, 02:54 PM
Well, there is a type in chris's code...

setTimeout

Also, there are several logic errors in it. However, you cannot force-close an alert. They REQUIRE interaction from the user.

rm-f
09-13-2005, 07:30 PM
I would like to reiterate this question.

Is it possibel to fire the mouseClick event to the Alert?

or any other idea?

felgall
09-13-2005, 10:09 PM
You can't do it with an alert. You would need to create your own overlay on the page with the desired content in order to do that. The early tutorials on Animation that I have at http://javascript.about.com/od/animationtutorials/ cover showing and hiding page content including timed actions.

rm-f
09-13-2005, 10:58 PM
I have found an excellent modal popup examle
http://slayeroffice.com/code/custom_alert/
but the solution does not meet my needs.