• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

173
Views
Why is this timer working and not working?

I made a java timer everything works when all the code is in one file and separated. When I start doing anything about it create a separate js file and move the java code there and even when i try to insert it inside php nawiada in both cases it stops working how is it like here it works and it's great. but i want js in js file then it stops working, I think it is about "'these elements but I don't know, I'll tire of the timer, best regards

var secs = 0;
var element = "czas"; 
var T = null;
function count(id)
{
    temp = secs;
    if(secs > 0)
    {
        result = Math.floor(temp) + "  ";
        document.getElementById(element).innerHTML = result;
        secs--;
    }
    else
    {
        document.location="/"
        clearInterval(T);
    }
}
function counter(seconds)
{
    secs = seconds;
    T = window.setInterval("count()", 1000);
}


echo
    '<div id="czas"></div>
    <script type="text/javascript">counter(60);</script>'
;
about 3 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error