Tip: You can modify some of the code before running
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <meta http-equiv=" Content-type "content=" text/html; charset=gb2312 "/> <title> Other one can calculate the countdown effect </title> <style type=" Text/css "> body{font-size:12px;} #years {width:40px; font-size:12px;} select{font-size:12px;} #days {font-size:12px; width:20px;} label{margin:0 4px;} #divYear {width:150px padding:5px; border:1px solid #999-moz-border-radius:5px-moz-box-shadow:2px 2px 1px #ccc; Word-wrap:break-word;} #divYear a{cursor:pointer;padding:1px 4px;} #divYear a:hover{background: #ccc; color: #fff;} </style> <script Type= "Text/javascript" > Function Addloadevent (func) {var oldonload = window.onload; if (typeof window.onload!= "function") {window.onload = func; else {window.onload = function () {oldonload (); Func (); }} function StarttiMe () {var weekday = new Array (7); Weekday[0] = "Sunday" weekday[1] = "Monday" weekday[2] = "Tuesday" weekday[3] = "Wednesday" weekday[4] = "Thursday" we EKDAY[5] = "Friday" weekday[6] = "Saturday" var today=new Date () var year=today.getfullyear () var month=today.ge Tmonth () +1 var day=today.getdate () var week= weekday[today.getday ()] var h=today.gethours () var m=today.getmin Utes () var s=today.getseconds () month=checktime (month) day=checktime (day) h=checktime (h) m=checktime (m) S=checktime (s) document.getElementById (' Today '). Innerhtml= "It is" +year+ "year" +month+ "month" +day+ "Day" +week+ "" +h+ ":" +m+ ":" + S T=settimeout (' StartTime () ', +)} keyyear = "Keynummonth =" "Keyday =" function FDate () {keyyear = document.getElementById ("Years"). Value; Keymonth = document.getElementById ("months"). Value; Keynummonth = document.getElementById ("months"). SelectedIndex; Keyday = document.getElementById ("Days"). Value; KeyTime = Keymonth + "" + Keyday + "," + keyyear; Countdown (KeyTime); SetTimeout ("FDate ()")} function Countdown (j) {var nowdate = new Date ();//Instantiate var nowtime = Nowdate.getti Me ()//The number of milliseconds to get the current date var newtime = Date.parse (j);//The number of milliseconds to get the target date var etime = parseint ((Math.Abs (Newtime-nowtime))/1000)// To the number of seconds var ES = etime%60;//Fetch remainder gets the second var EM = parseint (etime/60) var EMM = em%60;//Take the remainder to get the minute, the next method is the same. var EH = parseint ( EM/60); var ED = parseint (EH/24); var EH = eh%24; es = Checktime (es); EMM = Checktime (EMM); document.getElementById ("TXT"). innerhtml= "The Distance" +keyyear+ "The Year" +keynummonth+ "the Month" +keyday+ "The day also has" the +ed+ "the Day" +eh+ "The Hour" +emm+ "the Cent" + es+ "SEC"} function Checktime (i) {if (i<10) {i= "0" + i} Return i} addloadevent (starttime); </script> </pead> <body> <div id= "Today" ></div> <form> <p> Enter the date to be calculated </ h3> <p><input type= "text" value= "id=" Years "/><label> years </label><select id=" months " ><opTion>--</option><option value= "class=" "1" >1</option><option value= "Feb" >2</ Option><option value= "Mar" >3</option><option value= "Apr" >4</option><option value= " May ">5</option><option value=" June ">6</option><option value=" >7</option>< Option value= "Aug" >8</option><option value= "Sep" >9</option><option value= "Oct" >10</ Option><option value= "Nov" >11</option><option value= "Dec" >12</option></select> <label> month </label><input type= "text" value= "" id= "Days"/><label> Day </label></p> <p><input type= "button" value= "calculation" onclick= "FDate ()"/></p> </form> <p id= "TXT" ></ p> </body> </ptml></td> </tr> </table>
Tip: You can modify some of the code before running