Code
<script language="JavaScript">
function person_in() {
enter=new Date();
}
function person_out() {
exit=new Date();
time_dif=(exit.getTime()-enter.getTime())/1000;
time_dif=Math.round(time_dif);
alert ("You've only been here for: " + time_dif + " seconds!")
}
startday = new Date();
clockStart = startday.getTime();
function initStopwatch() {
var myTime = new Date();
var timeNow = myTime.getTime();
var timeDiff = timeNow - clockStart;
this.diffSecs = timeDiff/1000;
return(this.diffSecs); }
function getSecs() {
var mySecs = initStopwatch();
var mySecs1 = ""+mySecs;
mySecs1= mySecs1.substring(0,mySecs1.indexOf(".")) + " сек.";
document.forms[0].timespent.value = mySecs1
window.setTimeout('getSecs()',1000); }
</script>
<form>
<div align="center"><center>
<font color="#000000" face="MS Sans Serif" size="2">Вы находитесь на этой странице уже:
</font><input type="text" size="20" name="timespent" onFocus="this.blur()"
style="font-family: sans-serif; text-align: left; font-size: 10pt; background-color:#FFFFFF; color: #000000; border:none"></p>
</center></div>
</form>