본문 바로가기

javascript

앞으로, 뒤로, 소스보기, 다시읽기 보너스로 2000년까지 남은 날짜 계산

[스크립트]

<form>
<!--뒤로가기버튼-->
<input type="button" value="Back" onClick="history.go(-1)"></form>

<form>
<!--새로고침버튼-->
<input type="button" value="Reload" onClick="history.go(0)"></form>

<form>
<!--소스보기버튼-->
<input type="button" value="Source" onClick='window.location="view-source:"+window.location.href'></form>

<form>
<!--앞으로가기버튼-->
<input type="button" value="Forward" onClick="history.go(1)"></form>

<!-- 2000년까지 남은 날짜 계산-->

<script name="JavaScript">

/*

Script by Jari Aarniala (foo@mbnet.fi)

This script counts how many days are left to a date
You may use this script freely if all credit is given to me...

*/

today = new Date()    
y2k = new Date("January 1, 2000")
y2k.setYear = today.getYear;  
daysLeft = (y2k.getTime() - today.getTime()) / (1000*60*60*24);
daysLeft = Math.round(daysLeft);
document.write("<center><I>~~ Only "+daysLeft+" days until the year 2000 ~~</I></center>");

</script>