Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html> 
<html>
    <head>
        <meta charset="utf-8">
        
        <script>
            var chnDay = ["日", "一", "二", "三", "四", "五", "六"]
            var t = new Date();
            var y = t.getFullYear();
            var m = t.getMonth() + 1;
            var d1 = t.getDate();
            var d2 = t.getDay();
        
            function displayCalender(i)
            {
             d1 += i;
             d2 = (d2 + i + 7) % 7;
             var s = '<h2 align="center">' + y + '年' + m + '月</h2>';
             s += '<h1 align="center">' + d1 + '</h1>';
             s += '<h3 align="center">星期' + chnDay[d2] + '</h3>';
             document.getElementById("showCalender").innerHTML = s;
            }
        </script>
    </head>
    <body>
        <div id="showCalender"></div>
        <script>displayCalender(0)</script>
        <a href="javascript:displayCalender(-1)" style="float:left;">前一天</a>
        <a href="javascript:displayCalender(1)" style="float:right;">後一天</a>
    </body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers