87,910
社区成员
发帖
与我相关
我的任务
分享
<br>距离考研还有<br>
<span id="span_dt_dt" style='border:1px solid black;background-color:#FFFFFF' ></span>
<SCRIPT language=javascript>
<!--
//document.write("");
function showtime(){
window.setTimeout("showtime()", 1000);
BirthDay=new Date("01-07-2012");//改成你的计时日期,格式为MM-DD-YYYY
today=new Date();
timeold=(BirthDay.getTime()-today.getTime());
sectimeold=timeold/1000
secondsold=Math.floor(sectimeold);
msPerDay=24*60*60*1000
e_daysold=timeold/msPerDay
daysold=Math.floor(e_daysold);
e_hrsold=(e_daysold-daysold)*24;
hrsold=Math.floor(e_hrsold);
e_minsold=(e_hrsold-hrsold)*60;
minsold=Math.floor((e_hrsold-hrsold)*60);
seconds=Math.floor((e_minsold-minsold)*60);
span_dt_dt.innerHTML=daysold+"天"+hrsold+"小时"+minsold+"分"+seconds+"秒" ;
}
showtime();
<body>
<center>
<input type="text" id="txtLevel" name="txtLevel" value="01-07-2012" /><br /><br />
<span id="span_dt_dt"></span>
</center>
</body>
<html>
<head>
<script type="text/javascript">
function xph(id){return document.getElementById(id);}
function showtime(){
window.setTimeout("showtime()", 1000);
var inputDate=xph("txtLevel").value;
BirthDay=new Date(inputDate);//改成你的计时日期,格式为MM-DD-YYYY
today=new Date();
timeold=(BirthDay.getTime()-today.getTime());
sectimeold=timeold/1000
secondsold=Math.floor(sectimeold);
msPerDay=24*60*60*1000
e_daysold=timeold/msPerDay
daysold=Math.floor(e_daysold);
e_hrsold=(e_daysold-daysold)*24;
hrsold=Math.floor(e_hrsold);
e_minsold=(e_hrsold-hrsold)*60;
minsold=Math.floor((e_hrsold-hrsold)*60);
seconds=Math.floor((e_minsold-minsold)*60);
xph("span_dt_dt").innerHTML=daysold+"天"+hrsold+"小时"+minsold+"分"+seconds+"秒" ;
}
showtime();
</script>
</head>
<body>
<input type="text" id="txtLevel" name="txtLevel" value="01-07-2012" />
<span id="span_dt_dt"></span>
</body>
</html>