Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Javascript clock - pomoc

[es] :: Javascript i AJAX :: Javascript clock - pomoc

[ Pregleda: 1355 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

davidkovacs2

Član broj: 127323
Poruke: 192
*.cable-1.sattrakt.net.



+1 Profil

icon Javascript clock - pomoc15.10.2007. u 21:07 - pre 201 meseci
Treba mi jedan javascript sat za html sajt... - E sad, nasao sam ja jedan odgovarajuci, nego ima americko ili sta ja znam kakvo vreme... evo koda:

Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
var timerID = null;
var timerRunning = false;
function stopclock (){
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}
function showtime () {
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds()
var timeValue = "" + ((hours >12) ? hours -12 :hours)
if (timeValue == "0") timeValue = 12;
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += ((seconds < 10) ? ":0" : ":") + seconds
timeValue += (hours >= 12) ? " P.M." : " A.M."
document.clock.face.value = timeValue;
timerID = setTimeout("showtime()",1000);
timerRunning = true;
}
function startclock() {
stopclock();
showtime();
}
// End -->
</SCRIPT>
<BODY onLoad="startclock()">
<body>
<CENTER>
<FORM name="clock">
<input type="text" name="face" size=13 value="">
</FORM>
</CENTER>

</body>
</html>


- Ako neko moze, i zna, neka mi napravi od ovog koda da tacno pokazuje nase vreme...

- P.S: Ako neko zeli da ponudi neki drugi kod, vazno je da sat izgleda ovako jednostavno:
 
Odgovor na temu

Gost




Profil

icon Re: Javascript clock - pomoc16.10.2007. u 00:09 - pre 201 meseci
Nadam se da ce ovo pomoci:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
var timerID = null;
var timerRunning = false;
function stopclock (){
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}
function showtime () {
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds()
var timeValue = "" + ((hours >24) ? hours -12 :hours)
if (timeValue == "0") timeValue = 0;
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += ((seconds < 10) ? ":0" : ":") + seconds
document.clock.face.value = timeValue;
timerID = setTimeout("showtime()",1000);
timerRunning = true;
}
function startclock() {
stopclock();
showtime();
}
// End -->
</SCRIPT>
<BODY onLoad="startclock()">
<body>
<CENTER>
<FORM name="clock">
<input type="text" name="face" size=4 value="">
</FORM>
</CENTER>
</body>
</html>

Pozdrav!
 
Odgovor na temu

[es] :: Javascript i AJAX :: Javascript clock - pomoc

[ Pregleda: 1355 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.