Lifecounter
Код скрипта
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--
function lifetimer(){
today = new Date()
BirthDay = new Date(document.live.age.value)
timeold = (today.getTime() - BirthDay.getTime());
sectimeold = timeold / 1000;
secondsold = Math.floor(sectimeold);
msPerDay = 24 * 60 * 60 * 1000 ;
timeold = (today.getTime() - BirthDay.getTime());
e_daysold = timeold / msPerDay;
daysold = Math.floor(e_daysold);
e_hrsold = (e_daysold - daysold)*24;
hrsold = Math.floor(e_hrsold);
minsold = Math.floor((e_hrsold - hrsold)*60);
document.live.time1.value = daysold
document.live.time2.value = hrsold
document.live.time3.value = minsold
window.status = "Well at the moment you are " + secondsold + "............ seconds old.";
timerID = setTimeout("lifetimer()",1000)
}
// -- done hiding from old browsers -->
</script>
<center>
<h2>Lifecounter</h2>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!-- hide this script tag's contents from old browsers
var today = new Date()
dayStr = today.toLocaleString();
document.write("<b>Date:");
document.write(dayStr);
document.write("</b>");
// -- done hiding from old browsers -->
</script>
<br><br><br>
<form name="live">
Your Age please:<INPUT TYPE="text" NAME="age" VALUE="" SIZE=20>
Example: (november 1,1966) <br><br><br>
<INPUT TYPE="button" NAME="start" VALUE="Start Timer" ONCLICK="lifetimer(this.form)">
<INPUT TYPE="reset" NAME="resetb" VALUE="Reset Age">
<br><br>
<table border=0>
<tr><td>You are days old:</td>
<td>
<INPUT TYPE="text" NAME="time1" VALUE="" size=8>
</td>
</tr>
<tr><td>You are ours old:</td>
<td>
<INPUT TYPE="text" NAME="time2" VALUE="" size=8>
</td>
</tr>
<tr><td>You are minutes old:</td>
<td><INPUT TYPE="text" NAME="time3" VALUE="" size=8></td>
</tr>
</table>
</form>