Click here to Skip to main content
15,907,687 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI All,

i want to display one alert box with countDown using javascript.
anyone can help me on this?
Posted

1 solution

Try
XML
<script type="text/javascript" language="javascript">
        var counter = 10; var timerId;

        timerId = setInterval("ShowAlert()", 1000);

        function ShowAlert() {
            if (counter != 0) {
                alert(counter);
                counter = counter - 1;
            }
            else {
                clearInterval(timerId);
            }
        }
    </script>
 
Share this answer
 
Comments
Ankur Ramanuj 6-Dec-14 6:40am    
actually what i want is
at first time open a alert box and after that counter is display in same alertbox.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900