Логин:   Пароль:






Новости
Рассылки
Форум
Поиск


Java
- Апплеты
- Вопрос-ответ
- Классы
- Примеры
- Руководства
- Статьи
- IDE
- Словарь терминов
- Скачать

Мобильная Java
- Игры
- Примеры
- Статьи
- WAP, WML и пр.

JavaScript
- Вопрос-ответ
- Примеры
- Статьи

Веб-мастеринг
- HTML
- CSS
- SSI

Разминка для ума
Проекты
Книги
Ссылки
Программы
Юмор :)




Rambler's Top100
Rambler's Top100

JavaScript: ПримерыТри примера часиков

Три примера часиков

Пример 1

Часики в строке статуса.


<html>
<head>
<title>Часы</title>
<script language="JavaScript">
function clock()
{
 today=new Date();
 clock_status=today.getHours()+":"+today.getMinutes()+":"+today.getSeconds()
 status=clock_status;
 setTimeout("clock()",100);
}
</script>
</head>
<body onLoad="clock()">
</body>
</html>

Пример 2

Часики в поле form


<html>
<head>
<title>Часы</title>
<script language="JavaScript">
function clock()
{
 today=new Date()
 clock_form=today.getHours()+":"+today.getMinutes()+":"+today.getSeconds()
 document.form1.clock_form.value=clock_form
 setTimeout("clock()",100)
}
</script>
</head>
<body onLoad="clock()">
<center>
<form name="form1">
<input name="clock_form" maxlength="8" size="8">
</form>
</center>
</body>
</html>

Пример 3

Часики с "P.M." и "A.M."


<html>
<head>
<title>Часы</title>
<script language="JavaScript">
function clock()
{
 today=new Date();
 hours=today.getHours();
 minutes=today.getMinutes();
 seconds=today.getSeconds();
 timevalue=" " + ((hours>12) ? hours-12 : hours) 
 timevalue += ((minutes<10) ? ":0" : ":") + minutes
 timevalue += ((seconds<10) ? ":0" : ":") + seconds
 timevalue +=(hours>=12) ? "P.M." : "A.M."
 document.form1.clock_form.value=timevalue;
 setTimeout('clock()',1000);
}
</script>
<body onLoad="clock()">
<center>
<form name=form1>
<input type=text name=clock_form size=12 value=' '>
</center>
</form>
</body>
</html>



Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /pub/home/javaport/javaportal/books/show2b.php on line 11

Warning: mysql_db_query() [function.mysql-db-query]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /pub/home/javaport/javaportal/books/show2b.php on line 19

Warning: mysql_db_query() [function.mysql-db-query]: A link to the server could not be established in /pub/home/javaport/javaportal/books/show2b.php on line 19

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /pub/home/javaport/javaportal/books/show2b.php on line 30
Узнай о чем ты на самом деле сейчас думаешь тут.


[an error occurred while processing this directive]



Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /pub/home/javaport/javaportal/news/worldnews.php on line 91

Warning: mysql_db_query() [function.mysql-db-query]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /pub/home/javaport/javaportal/news/worldnews.php on line 93

Warning: mysql_db_query() [function.mysql-db-query]: A link to the server could not be established in /pub/home/javaport/javaportal/news/worldnews.php on line 93

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /pub/home/javaport/javaportal/news/worldnews.php on line 95