js 현재 날짜 코드 가 져 오기 웹 페이지 머리 에 적용

 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
function bodyLoad(){
var dateTime=new Date();
var hh=dateTime.getHours();
if(hh<10) hh = '0' + hh;
var mm=dateTime.getMinutes();
if(mm<10) mm = '0' + mm;
var ss=dateTime.getSeconds();
if(ss<10) ss = '0' + ss;
var yy=dateTime.getFullYear();

var MM=dateTime.getMonth()+1; // 1 0, 1
var dd=dateTime.getDate();
var week=dateTime.getDay();
var days=[ " ", " ", " ", " ", " ", " ", " ",]
document.getElementById("date").value=yy+" "+MM+" "+dd+" "+" "+days[week] ;
document.getElementById("time").value=hh+":"+mm+":"+ss;
setTimeout(bodyLoad,1000);
}
</script>
</head>
<body onload="bodyLoad()">
<input type="text" id="date" style="border:0 none;" /><input type="text" id="time" style="border:0 none;" />
</body>
</html>

좋은 웹페이지 즐겨찾기