Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9258955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:32:16+00:00 2026-06-18T12:32:16+00:00

I have designed 2 pages For some unknown reason the second one is not

  • 0

I have designed 2 pages

For some unknown reason the second one is not refreshing the countdown script, it is only loading it once.

I have tried putting the javascript in various locations on the code and even calling it from an external file, however this just breaks the countdown script entirely.

For anyone who would like to use this countdown javascript please feel free to do so. The code is below:

<script>

var timeout;

// Uncomment below to use one.
var reset = function() {
    //timeout = weekly(4, 12, 5); // 0=sunday, 6 = saturday
    //timeout = daily(2, 0, 0);
    timeout = new Date('25-Feb-2013');
}

var displayEndText = function() {
    end_day = timeout.getDay();
    end_date = timeout.getDate();
    end_month = timeout.getMonth();
    end_year = timeout.getFullYear();
    end_hour = timeout.getHours();

    var now = new Date();
    todays_midnight = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1);
    tomorrows_midnight = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 2);

    dayText = "eek";
    timeText = "bar";

    a_p = "";
    if (end_hour < 12) {
        a_p = "AM";
    } else {
        a_p = "PM";
        end_hour -= 12;
    }
    end_min = timeout.getMinutes();
    if (end_min < 10) end_min = "0" + end_min;
    if ((end_hour == 0) && (end_min == 0)) {
        if (a_p == "AM") {
            timeText = "Midnight";
            var prevDay = new Date(timeout.getFullYear(), timeout.getMonth(), timeout.getDate() - 1);
            end_day = prevDay.getDay();
            end_date = prevDay.getDate();
        } else {
            timeText = "Midday";
        }
    } else {
        timeText = end_hour + ":" + end_min +" " + a_p;
    }

    if (timeout <= todays_midnight) {
        if ((end_hour == 0) && (end_min == 0)) {
            dayText = "";
        } else {
            dayText = "Today";
        }
    } else if (timeout <= tomorrows_midnight) {
        dayText = "Tomorrow";
    } else {
        d_names = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
        m_names = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
        var sup;
        switch (end_date) {
        case 1: 
        case 21:
        case 31: 
            sup = "st"; 
            break;
        case 2:
        case 22: 
            sup = "nd"; 
            break;
        case 3:
        case 23:
            sup = "rd";
            break;
        default:
            sup = "th";
        }
        dayText = d_names[end_day] + " " + end_date + "<SUP>" + sup + "</SUP> "
    }
    //document.getElementById('ed').innerHTML = d_names[end_day] + " " + end_date + "<SUP>" + sup + "</SUP> " + m_names[end_month] + " " + end_year + " at " + end_hour + " : " + end_min + " " + a_p;

    document.getElementById('ed').innerHTML = dayText + " at " + timeText;
}


var display = function () {
    var now = new Date();
    var secondsToGo = Math.ceil((timeout - now) / 1000);
    if (secondsToGo < 0) {
        reset();
        secondsToGo = Math.ceil((timeout - now) / 1000);
        window.location = "http://modeliving.co.uk/index1.php";
    }
    var secs = Math.floor(secondsToGo % 60);
    var minutesToGo = Math.floor(secondsToGo / 60);
    var mins = Math.floor(minutesToGo % 60);
    var hoursToGo = Math.floor(minutesToGo / 60);
    var hours = hoursToGo % 24;
    var daysToGo = Math.floor(hoursToGo / 24);

    if (secs < 10) secs = "0" + secs;
    if (mins < 10) mins = "0" + mins;
    if (hours < 10) hours = "0" + hours;    

    document.getElementById('cdDays').innerHTML = daysToGo;
    document.getElementById('cdHours').innerHTML = hours;
    document.getElementById('cdMins').innerHTML = mins;
    document.getElementById('cdSecs').innerHTML = secs;
    // document.getElementById('cdAll').innerHTML = daysToGo + ' days ' + hours + ' hours ' + mins + ' minutes ' + secs + ' seconds';

    displayEndText();
}

var weekly = function(dow, hour, min) {
    if (typeof(dow)==='undefined') dow = 1; // sunday midnight
    if (typeof(hour)==='undefined') hour = 0;
    if (typeof(min)==='undefined') min = 0;
    //dow = dow % 7;
    var now = new Date();
    var daysToGo = dow - now.getDay();
    if (daysToGo < 0) daysToGo += 7;
    if ((daysToGo == 0) && ((now.getHours()*60 + now.getMinutes()) >= (hour*60 + min))) daysToGo = 7;
    var result = new Date(now.getFullYear(), now.getMonth(), now.getDate()+daysToGo, hour, min, 0, 0);
    return result;
}

var daily = function(every, hour, min) {
    if (typeof(every)==='undefined') every = 2; // every 2 days
    if (typeof(hour)==='undefined') hour = 0;
    if (typeof(min)==='undefined') min = 0;
    var now = new Date();
    var daysToGo = Math.floor(((now - 0) / 1000 / 60 / 60 / 24) % every);
    if ((daysToGo == 0) && ((now.getHours()*60 + now.getMinutes()) >= (hour*60 + min))) daysToGo = every;
    var result = new Date(now.getFullYear(), now.getMonth(), now.getDate()+daysToGo, hour, min, 0, 0);
    return result;
}

reset();
display();
setInterval(display, 1000);

</script>

and then add this to the html:

<div id="cdDays"></div>
<div id="cdHours"></div>
<div id="cdMins"></div>
<div id="cdSecs"></div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:32:17+00:00Added an answer on June 18, 2026 at 12:32 pm

    Comment line 178 and it works. You are trying to access an element with id=’ed’ that doesn’t exist.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have designed a site and my CSS is not loading in FF and
I have some pages designed by someone else as simple HTML that I need
I have an inherently complicated page designed by an idot running a script on
I have designed one sign-up form,in this form after getting all necessary values I
i hv designed one user control, and used on my aspx pages whereever needed.
I have used 960gs to get a first version of some pages going (I
I designed a few web pages using some CSS3. It looks good in Google
I have a facebook application (not written by me, but have some control of
I have inherited a broad, ill-designed web portfolio at my job. Most pages are
I have several pages designed to be called with AJAX - I have them

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.