25-08-2009, 19:36 (Ten post był ostatnio modyfikowany: 25-08-2009, 20:00 przez dziamber.)
Mam akurat to zagadnienie w książce, jak znajdę to postaram się opisac co i jak
edit //
Już znalazłem. Oto kod:
Kod:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
<title>Licznik na stronie Księgi JavaScript</title>
<script type = "text/javascript">
<!-- ukrywamy kod przed starszymi przegl±darkami
function setTimeSinceArriving(start_time, update_time) {
if (start_time == 0) {
start_time = getCurrentMillisecs();
}
var millisecs = getCurrentMillisecs();
var milliSecondsOnPage = millisecs - start_time;
var secondsOnPage = Math.round(milliSecondsOnPage / 1000);
document.timeForm.timeSince.value = secondsOnPage;
setTimeout("setTimeSinceArriving(" + start_time + "," + update_time + ")", update_time);
}
function getCurrentMillisecs() {
var now = new Date();
var millisecs = now.getTime();
return millisecs;
}
// od tego miejsca kod będzie na powrót widoczny -->
</script>
</head>
<body onLoad = "setTimeSinceArriving(0, 500)">
<form name = "timeForm">
Jeste¶ na tej stronie od
<input type = "text" name = "timeSince" size = "10">
sekund.
</body>
</html>