Hi I’m trying to create a simple countdown.
Here is my code but it’s not working.
Can you help me find the problem?
function count() {
for (var cc=20,cc > 0,cc--) {
document.getElementById("cco").innerHTML=cc;
}
}
count();
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’re using commas instead of semicolons.
should be
However, this probably won’t do what you think it will, as the loop will count all the way to 0 immediately (so the user won’t even see the countdown). I’m guessing you wanted something like:
See setInterval and clearInterval for more information.