-
setTimeout(a,b),a是每隔一段時(shí)間刷新的函數(shù),b是間隔的時(shí)間查看全部
-
getDay()返回星期,getDate()才返回日期查看全部
-
方法及返回值查看全部
-
團(tuán)購(gòu)、限時(shí)搶 倒計(jì)時(shí)查看全部
-
輸出當(dāng)前系統(tǒng)時(shí)間查看全部
-
距元旦還有43天查看全部
-
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>團(tuán)購(gòu)——限時(shí)搶</title> <link rel="stylesheet" href="style.css" /> </head> <body> <div class="content3"> <div class="time">還剩 <span id="LeftTime"></span></div> </div> <script> window.onload=function(){ FreshTime(); } function FreshTime() { var endtime=new Date("2016/12/20,12:20:12");//結(jié)束時(shí)間 var nowtime = new Date();//當(dāng)前時(shí)間 var lefttime= parseInt((endtime.getTime()-nowtime.getTime())/1000) ; d= parseInt(lefttime/(24*60*60)) ; h= parseInt(lefttime/(60*60)%24) ; m= parseInt(lefttime/60%60) ; s= parseInt(lefttime%60) ; document.getElementById("LeftTime").innerHTML=d+"天"+h+"小時(shí)"+m+"分"+s+"秒"; if(lefttime<=0){ document.getElementById("LeftTime").innerHTML="團(tuán)購(gòu)已結(jié)束"; clearInterval(sh); } } FreshTime() var sh; sh= setInterval(FreshTime,1000) ; </script> </body> </html>查看全部
-
setInterval("FreshTime()",500) "函數(shù)名()" setInterval(FreshTime,500) 函數(shù)名 循環(huán)要放在函數(shù)中?。?!查看全部
-
不加引號(hào)var timedate= new Date(2017,0,1); //自定義結(jié)束時(shí)間2017,1,1 加引號(hào)var timedate= new Date("2017/1/1"); //自定義結(jié)束時(shí)2017,1,1查看全部
-
Date對(duì)象2查看全部
-
Date對(duì)象查看全部
-
FullYear,Month,Date,weekday,House,Minutes,Seconds,Day查看全部
-
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>研究生考試時(shí)間</title> <link rel="stylesheet" href="style.css" /> </head> <script language="javascript" type="text/javascript"> window.onload = function(){ var timedate= new Date("2017 3 1"); //自定義結(jié)束時(shí)間 var now = new Date() ; //獲取當(dāng)前時(shí)間 var date = timedate.getTime() - now.getTime(); //得出的為毫秒 var time =Math.ceil(date/(1000*60*60*24) ) ; //1000 * 60 * 60 * 24一天的秒數(shù) if(time > 0 ){ document.getElementById('timeShow').innerHTML = time; } } </script> </head> <body> <div class="content2"> <div class="txtshow">距離設(shè)置時(shí)間還有<span id="timeShow"></span>天</div> </div> </body> </html>查看全部
-
function check Time(i){ if(i<10){ i="0"+i; } return i; } 來解決gettime和getminuties的時(shí)候輸出時(shí)間可以前面帶0. 星期需要用數(shù)組。 setTimeout(showTime,500),該方法來使函數(shù)不斷循環(huán)打到時(shí)間不斷變化的目的。查看全部
-
%取余; Math.ceil向上取整 Math.floor向下取整 Math.round四舍五入 parseInt去除小數(shù)部分,只保留小數(shù),也就是向下取整?查看全部
舉報(bào)
0/150
提交
取消