Support » Fixing WordPress » Javascript in posts/pages

  • I want to run a javascript to calculate the amount of time left until a date. I have the script, but it won’t display on my page.

    The script is as follows:

    <SCRIPT language=JAVASCRIPT>
    today = new Date();
    BigDay = new Date("October 1, 2008")
    msPerDay = 24 * 60 * 60 * 1000 ;
    timeLeft = (BigDay.getTime() - today.getTime());
    e_daysLeft = timeLeft / msPerDay;
    daysLeft = Math.floor(e_daysLeft);
    e_hrsLeft = (e_daysLeft - daysLeft)*24;
    hrsLeft = Math.floor(e_hrsLeft);
    minsLeft = Math.floor((e_hrsLeft - hrsLeft)*60);
    document.write(daysLeft + " days " + hrsLeft +" hours and " + minsLeft + " minutes left");
    </SCRIPT>

    The page is here: http://www.senrable.com/blog/?page_id=73

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Javascript in posts/pages’ is closed to new replies.