html, script
현재시간 시계 스크립트
날씨좋군
2017. 4. 12. 20:20
<script language="javascript">
<!--
function psm(){
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
var time = "" + ((hours > 12)? hours-12 : hours);
time += ((minutes < 10)? ":0" : ":") + minutes;
time += ((seconds <10)? ":0" : ":") + seconds;
time += (hours >= 12)? " P.M":" A.M";
document.form1.text1.value = time;
timerID = setTimeout("psm()",1000);
}
//-->
</script>
<body onload="psm()">
<form name="form1">
<input type=text name="text1" size=10>
</form>