<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script>
function test(){
var today = new Date();
//today.setMonth(today.getMonth()+1);
// 1월 31일을 세팅
today.setMonth(0);
today.setDate(31);
alert(today.getFullYear()+":"+today.getDate());
alert(today.getMonth()+1);
var month = today.getMonth();
today.setMonth(today.getMonth()+1);
alert(today.getFullYear()+":"+today.getDate());
alert(today.getMonth()+1);
if(month+1 < today.getMonth()){
today.setDate(0);
}
// 실제표현되는 다음달
alert(today.getFullYear()+":"+today.getDate());
alert(today.getMonth()+1);
}
</script>
</head>
<body>
<a href="#" onclick="test();">test</a>
</body>
</html>
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script>
function test(){
var today = new Date();
//today.setMonth(today.getMonth()+1);
// 1월 31일을 세팅
today.setMonth(0);
today.setDate(31);
alert(today.getFullYear()+":"+today.getDate());
alert(today.getMonth()+1);
var month = today.getMonth();
today.setMonth(today.getMonth()+1);
alert(today.getFullYear()+":"+today.getDate());
alert(today.getMonth()+1);
if(month+1 < today.getMonth()){
today.setDate(0);
}
// 실제표현되는 다음달
alert(today.getFullYear()+":"+today.getDate());
alert(today.getMonth()+1);
}
</script>
</head>
<body>
<a href="#" onclick="test();">test</a>
</body>
</html>