计算当前月有几天

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>计算当前月有几天</title>
<script>
    var oDate=new Date();

    oDate.setMonth(oDate.getMonth()+1, 1);
    // 11-1下个月的月初
    oDate.setDate(0);
    // 10-31   上个月底 
    alert((oDate.getMonth()+1)+'-'+oDate.getDate());
</script>
</head>

<body>
</body>
</html>
原文地址:https://www.cnblogs.com/heboliufengjie/p/4149300.html