simple-jscalendar
Version:
Just a simple javascript calendar
51 lines (41 loc) • 1.34 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>jsCalendar</title>
<meta name="description" content="jsCalendar example">
<meta name="author" content="GramThanos">
<!-- jsCalendar -->
<link rel="stylesheet" type="text/css" href="../source/jsCalendar.css">
<script type="text/javascript" src="../source/jsCalendar.js"></script>
<!--[if lt IE 9]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<!-- Next month button -->
<button id="previous-button">Previous</button>
<button id="next-button">Next</button>
<!-- My calendar element -->
<div id="my-calendar"></div>
<!-- Create the calendar -->
<script type="text/javascript">
// Create the calendar
var myCalendar = jsCalendar.new("#my-calendar");
// Get the button
var previous_button = document.getElementById("previous-button");
// Add a button event
previous_button.addEventListener("click", function(){
// Go to the next month
myCalendar.previous();
}, false);
// Get the button
var next_button = document.getElementById("next-button");
// Add a button event
next_button.addEventListener("click", function(){
// Go to the next month
myCalendar.next();
}, false);
</script>
</body>
</html>