|
|
|
Часы в текстовом поле. Вариант 2.
<BODY onload="showTime()">
<script language="JavaScript">
<!--
function showTime() {
var timeNow = new Date();
var hours = timeNow.getHours();
var minutes = timeNow.getMinutes();
var seconds = timeNow.getSeconds();
var timeString = "" + ((hours > 12) hours - 12 : hours);
timeString += ((minutes < 10) ":0" : ":") + minutes;
timeString += ((seconds < 10) ":0" : ":") + seconds;
timeString += (hours >= 12) " p.m." : " a.m.";
document.htmlClock.timeField.value = timeString;
timerID = setTimeout("showTime()", 1000);
}
//-->
<FORM name="htmlClock">
<INPUT type="text" name="timeField" size=11></FORM>
|
|
|