묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
디지털 시계를 넣으려합니다.
2004.04.01 04:49
<html>
<head>
<title>무제 문서</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
</HEAD>
<BODY onLoad="DigitalTime()">
<SPAN id="liveclock" style="position:absolute;left:481px;top:151px;width:150px;height:50px;">
</SPAN>
<SCRIPT language="JavaScript">
<!-- 시계
function DigitalTime()
{
if (!document.layers && !document.all)
return
var DigitalClock = new Date();
var hours = DigitalClock.getHours();
var minutes = DigitalClock.getMinutes();
var seconds = DigitalClock.getSeconds();
var dn = "AM";
if (hours > 12)
{
dn = "PM";
hours = hours - 12;
}
if (hours == 0)
hours = 12;
if (minutes <= 9)
minutes = "0" + minutes;
if (seconds <= 9)
seconds = "0" + seconds;
//change font size here to your desire
digclock = "<font size='3' face='Arial' color='#FF9900'><b>" +
"<font size='1'>Now..</font></br>" +
hours + ":" + minutes + ":" + seconds + " " + dn + "</a></b></font>";
if (document.layers)
{
document.layers.liveclock.document.write(digclock);
document.layers.liveclock.document.close();
}
else if (document.all)
liveclock.innerHTML = digclock;
setTimeout("DigitalTime()",1000)
}
//-->시계끝
</script>
</body>
</html>
-----------------------------
위 소스는 우연히 nzeo 에서 발견한 디지털시계입니다.
우선 설치는 해놨는데
아쉬운게 시간만 나오고 날짜는 안나오더군요.
년,월,일. 가능하다면 요일도 나오게 하고싶은데요.
가능한가요? 가능하다면 어찌해야할지..
도움 부탁드립니다
<head>
<title>무제 문서</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
</HEAD>
<BODY onLoad="DigitalTime()">
<SPAN id="liveclock" style="position:absolute;left:481px;top:151px;width:150px;height:50px;">
</SPAN>
<SCRIPT language="JavaScript">
<!-- 시계
function DigitalTime()
{
if (!document.layers && !document.all)
return
var DigitalClock = new Date();
var hours = DigitalClock.getHours();
var minutes = DigitalClock.getMinutes();
var seconds = DigitalClock.getSeconds();
var dn = "AM";
if (hours > 12)
{
dn = "PM";
hours = hours - 12;
}
if (hours == 0)
hours = 12;
if (minutes <= 9)
minutes = "0" + minutes;
if (seconds <= 9)
seconds = "0" + seconds;
//change font size here to your desire
digclock = "<font size='3' face='Arial' color='#FF9900'><b>" +
"<font size='1'>Now..</font></br>" +
hours + ":" + minutes + ":" + seconds + " " + dn + "</a></b></font>";
if (document.layers)
{
document.layers.liveclock.document.write(digclock);
document.layers.liveclock.document.close();
}
else if (document.all)
liveclock.innerHTML = digclock;
setTimeout("DigitalTime()",1000)
}
//-->시계끝
</script>
</body>
</html>
-----------------------------
위 소스는 우연히 nzeo 에서 발견한 디지털시계입니다.
우선 설치는 해놨는데
아쉬운게 시간만 나오고 날짜는 안나오더군요.
년,월,일. 가능하다면 요일도 나오게 하고싶은데요.
가능한가요? 가능하다면 어찌해야할지..
도움 부탁드립니다
댓글 2
-
최영곤
2004.04.01 12:35
-
최영곤
2004.04.01 12:35
<html>
<head>
<title>무제 문서</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
</HEAD>
<BODY onLoad="DigitalTime()">
<SPAN id="liveclock" style="position:absolute;left:481px;top:151px;width:200px;height:50px;">
</SPAN>
<SCRIPT language="JavaScript">
<!-- 시계
function DigitalTime()
{
if (!document.layers && !document.all)
return
var DigitalClock = new Date();
// $ modified by +GONE+2004.04.01+yunggon@edunet4u.net+
// 년도,월,일, 요일 추가
var year = DigitalClock.getFullYear();
var month = DigitalClock.getMonth() + 1;
var date = DigitalClock.getDate();
var day = DigitalClock.getDay();
var hours = DigitalClock.getHours();
var minutes = DigitalClock.getMinutes();
var seconds = DigitalClock.getSeconds();
var dn = "AM";
if (hours > 12)
{
dn = "PM";
hours = hours - 12;
}
if (hours == 0)
hours = 12;
if (minutes <= 9)
minutes = "0" + minutes;
if (seconds <= 9)
seconds = "0" + seconds;
// 영문으로 날짜 변환
switch(day){
case 0 :
day = "sun";
break;
case 1 :
day = "mon";
break;
case 2 :
day = "tue";
break;
case 3 :
day = "wed";
break;
case 4 :
day = "thu";
break;
case 5 :
day = "fri";
break;
case 6 :
day = "sat";
break;
}
//change font size here to your desire
digclock = "<font size='3' face='Arial'+ '+ ' color='#FF9900'><b>" +
"<font size='1'>Now..</font></br>" +
year + "/" + month + "/" + date + "(" + day + ") " + hours + ":" + minutes + ":" + seconds + " " + dn + "</a></b></font>";
if (document.layers)
{
document.layers.liveclock.document.write(digclock);
document.layers.liveclock.document.close();
}
else if (document.all)
liveclock.innerHTML = digclock;
setTimeout("DigitalTime()",1000)
}
//-->시계끝
</script>
</body>
</html>
글쓴이 | 제목 | 최종 글 |
---|---|---|
XE | 공지 글 쓰기,삭제 운영방식 변경 공지 [16] | 2019.03.05 by 남기남 |
오락실주인 |
배경음악 애드온 사용방법 질문
[3]
![]() | 2014.04.30 by 오락실주인 |
임실치즈 | 좌측이나 우측 GNB(메뉴) 기준 레이아웃.. [6] | 2014.04.30 by 임실치즈 |
마마우스 | 제목순정렬 가능한가요? | |
왇더헬 | 알림센터 모듈에 대한 질문입니다. [12] | 2014.04.30 by 왇더헬 |
애니즌 | 로그인시 최근로그인 시간(last_login)이 갱신되는 시점.. | |
바가G | 추천수에 따라 제목에 효과주기 팁이 먹질 않아요ㅠㅠ (스케치북) [7] | 2014.04.30 by 바가G |
伯約 | 기본 캡차코드 적용방법 문의 [2] | 2014.04.30 by 伯約 |
온달왕자 | 현재 코어 1.7.4.1 에서는 smartux가 동작이 되질 않나요 ? | |
한라산삵쾡이 | 인터넷 방송관련 문의 [1] | 2014.04.30 by XE |
designare0 | 혹시 xe에는 그림 그리는 컴포넌트 같은게 없나요? [4] | 2014.04.30 by designare0 |
혜옥입니다. | 서브메뉴에서 사이트에서 없어져 보이네요. [3] | 2014.04.30 by mAKEkr |
Migguragi |
db 용량줄이기
![]() | |
가르송 |
부트스트랩 고수님들!!!1
![]() | |
베라ss | 로그인 기능 삭제 [1] | 2014.04.30 by 애니즌 |
designslam | 신디케이션 네이버 연동 질문드립니다. [7] | 2014.04.30 by Luatic™ |
imagineshop | 게시글 메일로 받을때 질문드릴게요..고수님들 부탁 [13] | 2014.04.30 by imagineshop |
안드로이더스스 | XE 최신버전 글쓰기오류 [7] | 2014.04.30 by 안드로이더스스 |
온달왕자 | 자료실과 같은 승인 미승인 변수 출력문제 | |
박경서726 | 다시 제이쿼리 질문드려요. [4] | 2014.04.30 by 박경서726 |
혜옥입니다. | 윈도우 7에서 홈페이지가 다 깨져보이네요..레이아웃이 바꿔져 보여요 [3] | 2014.04.30 by mAKEkr |
원리는
var hours = DigitalClock.getHours();
var minutes = DigitalClock.getMinutes();
var seconds = DigitalClock.getSeconds();
부분처럼 시, 분, 초를 받아온거 같이 년, 월, 일, 요일을 변수에 넣으시면 되구요
선언한 변수를 보여주기 위해서 작성한
digclock = "<font size='3' face='Arial' color='#FF9900'+ '+ '><b>" +
"<font size='1'>Now..</font></br>" +
hours + ":" + minutes + ":" + seconds + " " + dn + "</a></b></font>";
부분에 변수를 끼워 넣으시면 됩니다.