Expand|Select|Wrap|Line Numbers
- <html> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title></title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" type="text/css" media="screen" href="https://bytes.com/calender.css" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <script src="https://bytes.com/calender.js" type="text/javascript"></script> </head> <body onload="initialise();"> <button onclick="previous();"> <i class="fa fa-angle-down"></i></button> <span id="thismonth"></span> <button onclick="next();"> <i class="fa fa-angle-up"></i></button> </body> <script>
- var months = ["January","February","March","April","May","June","July","August","September","October","November","December"];
- var currentMonth=0;
- var currentYear=0;
- var d= new Date();
- currentMonth=d.getMonth();
- currentYear=d.getFullYear();
- var firstdate=months[currentMonth]+ " " + 1 + " " + currentYear;
- function initialise(){
- document.getElementById("thismonth").innerHTML=months[currentMonth]+ " " + currentYear;
- function previous(){
- if(currentMonth===0){
- currentMonth=11;
- currentYear=currentYear-1;
- }
- else if(currentMonth>0){
- currentMonth=currentMonth-1;
- }
- document.getElementById("thismonth").innerHTML=months[currentMonth]+ " " + currentYear;
- }
- function next(){
- if(currentMonth<11){
- currentMonth=currentMonth+1;
- }
- else if(currentMonth === 11){
- currentMonth=0;
- currentYear=currentYear+1;
- }
- document.getElementById("thismonth").innerHTML=months[currentMonth]+ " " +currentYear;
- }
- }
- </script> </html>