Joke Collection Website - Public benefit messages - How to write an html webpage to realize that there are ** days until the end of the month, ** days before the middle of the year, and ** days before the end of the year, and require automatic calculat

How to write an html webpage to realize that there are ** days until the end of the month, ** days before the middle of the year, and ** days before the end of the year, and require automatic calculat

How to write an html webpage to realize that there are ** days until the end of the month, ** days before the middle of the year, and ** days before the end of the year, and require automatic calculation based on the current time?

Simple js countdown

lt;!DOCTYPE HTMLgt;

lt;htmlgt;

lt;headgt;

meta http-equiv="Content-Type" content="text/html; charset=utf-8"gt;

lt;titlegt;Untitled documentlt;/titlegt;

lt; stylegt;

#s1 { font-size: 60px; font-weight: bold; }

lt;/stylegt;

lt;/headgt;

lt;bodygt;

lt;span id="s1"gt;lt;/spangt;

lt;/ bodygt;

lt;/htmlgt;

lt;scriptgt;

window.onload=function(){

var oSpan = document.getElementById('s1');

var nDate = new Date('sep 8, 2014'); //Modify the countdown time

showTime();

p>

setInterval(showTime, 1000);

function showTime(){

var oDate = new Date(); //Get the time of the local display

var time = Math.floor( (nDate - oDate) / 1000 );

var d = Math.floor( time / 86400 );

var h = Math. floor( time 86400 / 3600 );

var m = Math.floor( time 86400 3600 / 60 );

var s = time 60;

oSpan .innerHTML = "There are still days before the Mid-Autumn Festival in 2014: lt; br /gt;"

d 'day' h 'hour' m 'minute' s 'second';

}

};

lt;/scriptgt;