Note that there are some explanatory texts on larger screens.

plurals
  1. PONot getting the countdown feature in my webpage
    text
    copied!<p>I am making a contest platform ..For it I need a countdown timer ..The problem is that I donno JS ..So I googled up and got this script for the timer..But It is not working in the webpage...Please help me out.. Here is the code for the timer...I am getting the box for the div tag but not the timer in it...Please help me coz I am complete new bie in JS..</p> <pre><code> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"/&gt; &lt;title&gt;CoBo:Contest&lt;/title&gt; &lt;link href="css/master.css" rel="stylesheet" type="text/css"/&gt; &lt;script&gt; function start(myD, myH, myMins, mySecs, myL) { var d = new Date();// Returns the Day (number) so we can set it to default currentDay = d.getDate(); var month = 0;// '*' for next month, '0' for this month or 1 through 12 for the month var day = myD;// Offset for day of month day or + day var hour = myH;// 0 through 23 for the hours of the day var minutes = myMins;// Minutes of the hour to End on var seconds = mySecs;// Seconds of the minute to End on var tz = - 7;// Offset for your timezone in hours from UTC var lab = myL;// The id of the page entry where the timezone countdown is to show displayTZCountDown(setTZCountDown(month, day, hour, minutes, seconds, tz), lab); } function setTZCountDown(month, day, hour, minutes, seconds, tz) { var toDate = new Date(); if (month == '*') toDate.setMonth(toDate.getMonth() + 1); else if (month &gt; 0) { if (month &lt;= toDate.getMonth()) toDate.setYear(toDate.getYear() + 1); toDate.setMonth(month - 1); } if (day.substr(0, 1) == '+') { var day1 = parseInt(day.substr(1)); toDate.setDate(toDate.getDate() + day1); } else { toDate.setDate(day); } toDate.setHours(hour); toDate.setMinutes(minutes - (tz * 60)); toDate.setSeconds(seconds); var fromDate = new Date(); fromDate.setMinutes(fromDate.getMinutes() + fromDate.getTimezoneOffset()); var diffDate = new Date(0); diffDate.setMilliseconds(toDate - fromDate); return Math.floor(diffDate.valueOf() / 1000); } function displayTZCountDown(countdown, tzcd) { if (countdown &lt; 0) document.getElementById(tzcd).innerHTML = "&lt;b&gt;Ended&lt;/b&gt;"; else { var secs = countdown % 60; if (secs &lt; 10) secs = '0' + secs; var countdown1 = (countdown - secs) / 60; var mins = countdown1 % 60; if (mins &lt; 10) mins = '0' + mins; countdown1 = (countdown1 - mins) / 60; var hours = countdown1 % 24; var days = (countdown1 - hours) / 24; if (hours &lt; 10) { var hours = "0" + hours; } document.write(hours + ":" + mins + ":" + secs); document.getElementById(tzcd).innerHTML = hours + ':' + mins + ':' + secs; setTimeout('displayTZCountDown(' + (countdown - 1) + ',\'' + tzcd + '\');', 999); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="sidebar-top"&gt; &lt;div id="inner"&gt; &lt;script&gt; start('9', '25', '12', '00', '00', 'myTimerID'); &lt;/script&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload