Начало
Детали страницы
Время на странице (в секундах)
Вместо 00:00 считывания, она отображает "X секунд.
JavaScript Page Details: Время на странице (в секундах)
<!-- THREE STEPS TO INSTALL TIME ON PAGE (SECONDS): 1. Paste the coding into the HEAD of your HTML document 2. Copy the onLoad event handler into the BODY tag 3. Add the last code into the BODY of your HTML document --> <!-- STEP ONE: Copy this code into the HEAD of your HTML document --> <HEAD> <SCRIPT LANGUAGE="JavaScript"> <! > <! > <!-- Begin 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(".")) + " secs."; document.forms[0].timespent.value = mySecs1 window.setTimeout('getSecs()',1000); } // End --> </SCRIPT> <!-- STEP TWO: Add this onLoad event handler into the BODY tag --> <BODY onLoad="window.setTimeout('getSecs()',1)"> <!-- STEP THREE: Put this code into the BODY of your HTML document --> <CENTER> <FORM> <input size=9 name=timespent> </FORM> </CENTER> <!-- Script Size: 1.28 KB -->