loops - Javascript how to start script on exact time -
- script start on exact time (ex: 2015:06:15:00:00)
- if on time, alert hello every 1 second.
setinterval(function () {alert("hello")}, 1000);
could please me how make on up?
- i'd use gettime object in js
i believe have time set right in jsfiddle
var d = new date(); var year = d.getfullyear(); // month 0 = january | month 11 = december | changed vallues +one var month = d.getmonth() + 1; var day = d.getdate(); var hour = d.gethours(); var minute = d.getminutes(); var second = d.getseconds(); var overall = year.tostring() + month.tostring() + day.tostring() + hour.tostring() + minute.tostring() + second.tostring(); alert(overall); var checkdate = function () { if(overall==="20156150000") { setinterval(function(){ alert("hello"); }, 1000); }; }; window.setinterval(checkdate(), 1000);
Comments
Post a Comment