How To Use Sleep Function Using JavaScript

<html>
<head>

    <script language='javascript'>
        function sleep() {

            var Sleep = setTimeout("alert('Hi Have A Nice Time And Day ')", 2000);
            // 2000 Millisecond(2 sec)

        }
    </script>

    <body onload='sleep()'>
        Alert Box Will Be Displayed After 2 Seconds the Body is Loaded
    </body>
</html>

No comments:

Post a Comment