| Tytuł |
Zegar na stronie WWW |
| Przegląd głosów |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| 1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
|
| URL |
http://www.megaskrypty.com |
| Głosuj |
Ilość głosów : 17, Średnia : 5.29 |
| Data dodania |
07-07-2004 |
| ETC |
Odsłon : 15324, Wizyt : 8179, Komentarz : 2
|
Zegarek zostanie wy?wietlony w polu formularza. ?eby si? jednak pokaza? nie mo?na zapomnie? o o wstawieniu w body informacji o skrypcie: <BODY onLoad="startTimer()" onunload="stopTimer()">
W nag?ówku nale?y umie?ci?:
<SCRIPT> <!-- hide from non JS browsers.
//Define a couple of global variables.
var timerID = null
var timerRunning = false
function stopTimer(){
//stop the clock
if(timerRunning) {
clearTimeout(timerID)
timerRunning = false
}
}
function startTimer(){
// Stop the clock (in case it's running), then make it go.
stopTimer()
runClock()
}
function runClock(){
document.clock.face.value = timeNow()
//Notice how setTimeout() calls its own calling function, runClock().
timerID = setTimeout("runClock()",1000)
timerRunning = true
}
function timeNow() {
//Grabs the current time and formats it into hh:mm:ss am/pm format.
now = new Date()
hours = now.getHours()
minutes = now.getMinutes()
seconds = now.getSeconds()
timeStr = ((hours > 12) ? hours - 12 : hours)
timeStr += ((minutes < 10) ? ":0" : ":") + minutes
timeStr += ((seconds < 10) ? ":0" : ":") + seconds
timeStr += (hours >= 12) ? " PM" : " AM"
return timeStr
}
// End of custom functions, stop hiding code -->
</SCRIPT>
W body:
<FORM NAME="clock"><INPUT TYPE="text" NAME="face" SIZE=10></FORM> |
|
|