Javascript: Pop up DHTML calendar using CSS

If you are looking for a simple JavaScript calendar that uses CSS and is easy to customise, then take a look at my calendar.

Discontinued

Sorry, but this calendar is now discontinued.

The reason for this is that there are now so many great calendars out there that offer more functionality and accessibility. Have a look around and I'm sure you'll find something out there.


The Calendar

The calendar needs a JavaScript file and a CSS file which you can customise to suit your site. The JS file is only 14kb with comments. You simply put the javascript file in the <head> tag of your page and it will become available to use! See the examples below.

You can change the appearance of the calendar by simply changing the CSS to suit your needs. If you are feeling adventurous you can also dig into the JavaScript which is nicely commented so you can understand what's going on. You will have to change the CSS to suit your site as some of the other CSS you use on your pages might contradict what is in the calendar CSS - try it out and see how it goes!

Examples

  1. Blue popup calendar A simple popup calendar in blue that doesn't have the nice fading effect on
  2. Orange small popup calendar Another smaller sized calendar that uses the nice fading effect

Changelog

  • 29/01/2008 - Improved and reduced code, added fade effect and added tool tips to dates
  • 30/03/2007 - First version

Download


Comments 16

  1. How can I change the date format to mm/dd/yy in the display? Thanks Anup
  2. Hi Anup, a new version with selectable date formats is coming soon. Stewart
  3. Thank you for the reply. I'll be looking forward for the new version. Is there any quick fix for now? Anup
  4. I love the calendar, thanks! I have added some code to move the calendar if it falls off the page...

    place this code in the showCalendar function after x and y have been defined. You must also define calendarWidth and calendarHeight before this code. You have to define them based on the number of rows and cols in the table, and the widths, heights, margins and borders in the css.


    // Move the calendar if it falls off the page
    var pageWidth = 0;
    var pageHeight = 0;
    if (typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    pageWidth = window.innerWidth;
    pageHeight = window.innerHeight;
    } else if( document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight) ) {
    //IE 6+ in 'standards compliant mode'
    pageWidth = document.documentElement.clientWidth;
    pageHeight = document.documentElement.clientHeight;
    } else if( document.body && (document.body.clientWidth || document.body.clientHeight) ) {
    //IE 4 compatible
    pageWidth = document.body.clientWidth;
    pageHeight = document.body.clientHeight;
    }
    if(x+calendarWidth > pageWidth) x = pageWidth - calendarWidth;
    if(y+calendarHeight > pageHeight) y = pageHeight - calendarHeight - 5; // subtract 5 because of the y+5 in the next line
    weenaak
  5. I was having problems with another calendar + IE7 ... I found yours and want to say THANKS!!! I'm in the US, so I did need to change the date format. Replace line 200 of ezcalendar.js with the following:
    getID("cell"+r+c).href = "javascript:setDateValue('" + formatNumber(calendarDate.getMonth()+1) + dateSeparator + formatNumber(calendarDate.getDate()) + dateSeparator + calendarDate.getFullYear() + "')";


    makes the date mm/dd/yyyy ... hope it helps anyone else looking for the easy solution - thanks again! :) miss cassandra
  6. nice! i'm gonna make my own blog chicas rubias
  7. Works in IE+Opera+Firefox+Safari that's what i looked THANXXXXX))))) Mcs
  8. Very nice calendar! Saved me a lot time in coding my ERP project chuava
  9. Is there any way to make this calendar show up when the page loads and not have any of the form but just the calendar as a reference source for viewers on a page? I am not that good with js to know how to make it work. Bill
  10. Hi Bill, this is intended to update a input field when the user selects a date but you could change it so that it doesn't do anything by making a hidden input field:
    <input type="hidden" id="date1" />
    
  11. please, i have to recieve in my input type text something like this YYY-MM-DD, any idea?? Juan
  12. hello...how do i change the format to YYYY/MM/DD? Kaveena
  13. Hi i want report a problem with April of 2011 it displays like March. Why? Dimitris
  14. For date format (YYYY/MM/DD) replace line 200 of ezcalendar.js with : getID("cell"+r+c).href = "javascript:setDateValue('" + formatNumber(calendarDate.getFullYear()) + dateSeparator + formatNumber(calendarDate.getMonth()+1) + dateSeparator + calendarDate.getDate() + "')"; Dimitris
  15. Thanks you very much! Wonderful picker and very nice and usefully and CSS! Thanks again.. moda kulvar
  16. Very nice calendar. Question. How can I set a 2 digit year, like mm/dd/yy? Thanks! Kenny
  1. 1

Got something to say?

Join the discussion! You know how these things work; enter your details and comments below and be heard.

  1. Allowed tags: <b><i><br>