I have simple javascript alert box i want it to c开发者_Go百科lose automatically after 5 second. if possible help please.
<script type="text/javascript">
function show_alert()
{
alert("Hello! I am an alert box!");
}
</script>
<input type="button" onclick="show_alert()" value="Show alert box" />
You cannot close a JavaScript alert box, the user has to. If you want to do something like this, I suggest using a custom modal popup (like jQuery UI).
There is no way to close classic alert box. You can male your own using HTML + lock events, and use timer for closing.
精彩评论