Hello Forum !
What is the easiest way to display a counterdown on a SharePoint page?
I want something very simple and basic as I have a single fixed date for one single event. Therefore, Something like like the example below would be perfect:
You have: 22 Days, 23 Hours, 40 Seconds for ABC Event
Obviously, The timer must be accurate for all users so if someone from Europe or Australia or America opened the page, The timer must be correct.
I have tried using the script web part and reused some JavaScript code that I got from: (https://blog.smalldo.gs/2013/12/create-simple-countdown/) :
<h1 id="countdown-holder"></h1>
<script src="/js/countdown.js"></script>
<script>
var clock = document.getElementById("countdown-holder")
, targetDate = new Date(2016, 00, 05); // June 1, 2016
clock.innerHTML = countdown(targetDate).toString();
</script>
<script>
var clock = document.getElementById("countdown-holder")
, targetDate = new Date(2050, 00, 01); // Jan 1, 2050;
clock.innerHTML = countdown(targetDate).toString();
setInterval(function(){
clock.innerHTML = countdown(targetDate).toString();
}, 1000);
</script>
But, Nothing worked and nothing showed up on the page !!!
Could you please guide/correct me to be able to display it correctly ?
What is the easiest way to display a counterdown on a SharePoint page?
I want something very simple and basic as I have a single fixed date for one single event. Therefore, Something like like the example below would be perfect:
You have: 22 Days, 23 Hours, 40 Seconds for ABC Event
Obviously, The timer must be accurate for all users so if someone from Europe or Australia or America opened the page, The timer must be correct.
I have tried using the script web part and reused some JavaScript code that I got from: (https://blog.smalldo.gs/2013/12/create-simple-countdown/) :
<h1 id="countdown-holder"></h1>
<script src="/js/countdown.js"></script>
<script>
var clock = document.getElementById("countdown-holder")
, targetDate = new Date(2016, 00, 05); // June 1, 2016
clock.innerHTML = countdown(targetDate).toString();
</script>
<script>
var clock = document.getElementById("countdown-holder")
, targetDate = new Date(2050, 00, 01); // Jan 1, 2050;
clock.innerHTML = countdown(targetDate).toString();
setInterval(function(){
clock.innerHTML = countdown(targetDate).toString();
}, 1000);
</script>
But, Nothing worked and nothing showed up on the page !!!
Could you please guide/correct me to be able to display it correctly ?