<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML>
<style type="text/css">
.button{
height:19px;background-color: #f1f1f1;margin:none;padding:0 2px 0 3px!important;padding: 0 1px 0 2px;color: #000000;border-top: 1px solid #CCCCCC;border-left: 1px solid #CCCCCC;border-right: 1px solid #CCCCCC;border-bottom:1px solid #CCCCCC;background-image: url(img/button_bg.gif);margin:0 0 0 0;}
</style>
<BODY>
<input type="button" value="计时开始" class="button" id="buttonTime" onclick="startTime();" />
<input type="text" id="displayTime" readonly="readonly" align="middle" />
<input type="button" value="统计" class="button" onclick="getResult();" />
<input type="text" id="displayMoney" />
<input type="button" onclick="toZero();" value="归零" class="button" />
<br />
<input type="image" src="hide_b.gif" style=" background:#999999" />
<SCRIPT language=javascript>
<!--
//document.write("");
var currentTime;
var stopTimeout;
function show_date_time(){
stopTimeout = window.setTimeout("show_date_time()",1/1000);
timeold=((new Date()).getTime()-currentTime.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);
document.getElementById("displayTime").value=""+daysold+"天"+hrsold+"小时"+minsold+"分"+seconds+"秒";
}
function startTime(){
var v = document.getElementById("buttonTime").value;
currentTime=new Date();
if(v=="计时开始"){
document.getElementById("buttonTime").value="停止计时";
show_date_time();
}
else{
document.getElementById("buttonTime").value="计时开始";
window.clearTimeout(stopTimeout);
}
}
function getResult(){
document.getElementById("buttonTime").value="计时开始";
document.getElementById("displayMoney").value="one dollar";
window.clearTimeout(stopTimeout);
}
function toZero(){
document.getElementById("displayTime").value="0天0小时0分0秒";
document.getElementById("displayMoney").value="";
}
//-->
</SCRIPT>
</BODY>
回复 更多评论