ディジタル時計を作りました。
ソースは↓ DOCTYPEです
_______________________________________
<html>
<head>
<meta http-equiv="content-type" content="text/html;
charset=utf-8">
<title>時計</title>
<style type="text/css">
<!--
.cbase {
width: 310px;
height: 40px;
background-color: white;
}
#dclock {
width: 310px;
height: 40px;
text-align : center;
font-family : Verdana;
font-size : 25px;
color : black;
border : 5px inset #5070df;
cursor : arrow;
filter : shadow(color=#9eafe9,direction=225);
}
-->
</style>
<script type="text/javascript">
<!--
function jclock() {
var nowDate;
var intHour, intMinute, intSecond;
var strHour, strMinute, strSecond;
var strAmPm;
nowDate = new Date();
intHour =nowDate.getHours();
intMinute = nowDate.getMinutes();
intSecond = nowDate.getSeconds();
if(intHour == 0){
strHour = "0:";
strAmPm = "Midnight(深夜)";
} else if (intHour < 12){
strHour = intHour + ":";
strAmPm = "A.M.(午前)";
} else if (intHour == 12){
strHour = "12:";
strAmPm = "Noon(正午)";
} else {
intHour = intHour - 12;
strHour = intHour + ":";
strAmPm = "P.M.(午後)";
}
if (intMinute < 10 ){
strMinute = "0" + intMinute + ":";
} else {
strMinute = intMinute + ":";
}
if( intSecond < 10){
strMinute = "0" + intSecond+ " ";
} else {
strSecond = intSecond+ " ";
}
var timeStr = strHour + strMinute + strSecond + strAmPm;
document.getElementById("dclock").innerHTML = timeStr;
window.setTimeout("jclock();", 1000);
}
//-->
</script>
</head>
<body text="#aa0022" onload="jclock()">
<center>
<h1>
時計
</h1>
<div class="cbase">
<p id="dclock"></p>
</div>
</center>
</body>
</html>
_______________________________________