먼저 날짜를 지정하면 오늘은 지정된 날짜까지 몇일이나 남았는지를 계산하여 보여주는 스크립트이다. 월드컵이 몇일이나
남았는지 알아본다든지 내 생일이 얼마나 남았을까..등등에 쓰일 수 있다.
| HTML Example |
<html> <head>
<script language="JavaScript"> var
today = new Date(); var
day2000 = new Date("January 1, 2000"); var
days = Math.ceil((day2000-today)/24/60/60/1000);
</script> </head> <body
bgcolor=#bf3333 text=#ffffff> <center>
<script language="JavaScript"> document.write("앞으로
2000년은 " + days + "일 남았습니다!") </script>
</center> </body> </html> |
|
|
|