开发者

alert should close after 5 seconds [duplicate]

This question already has answers here: Javascript close alert box (11 answers) Closed 5 years ago.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜