Date background color

this is a very peculiar request but…
I need to change the backgroud color of certain dates to let my user know that he already “used” that date…
Something exacly like your holiday feature but that changes the backgroung color and not the font color.
Is there a way to access the backgrond color of a date?
Thank you!

Try to set holidays by onClick (and your custome style for holiday cell)

.dhtmlxcalendar_container div.dhtmlxcalendar_dates_cont ul.dhtmlxcalendar_line li.dhtmlxcalendar_cell.dhtmlxcalendar_cell_month_date_holiday { background-color: #FFFF00; background-image: none; background-position: 0; color: green; } .dhtmlxcalendar_container div.dhtmlxcalendar_dates_cont ul.dhtmlxcalendar_line li.dhtmlxcalendar_cell.dhtmlxcalendar_cell_month_holiday { background-color: #FFFF00; background-image: none; background-position: 0; color: green; }

myCalendar.attachEvent("onClick",function(date){ myCalendar.setHolidays(date); })

Hello Darya,
thanks for your help!
May I please ask you 2 more things?

  1. How do you access a calendar that is inside a form?

  2. By changing the CSS file as you suggested, you obviously loose the original holiday functionality. There is no way, at the moment, to have both at the same time, correct?

Thanks a lot!

  1. access calendar:

//getCalendar() method, there “mycal” - calendar name

  1. yes, there is no way to use them both

Thanks a lot Darya!

You are welcome!

Hi Darya,
I’m really sorry to open this topic again, but the code you gave me the other day is not having any effect.
I’m finally able to set the “holidays” from a database table as I needed, but the color of the background is not changing… only the number is turning red.
I placed your code in the sections you told me, commenting the 2 original settings.
This is how I set the “holiday”:


I found that there are about 30 tags containng the word “holiday”… do I need your code in all them?

Have you set the CSS?
Attaching my working sample
holidays.rar (70.3 KB)

Hi Darya!
Thank you very much for the attached code.
I had changed the CSS code directly in the CSS file and, for some reason I still don’t understand, the changes were not having any effect. I probably don’t know enough about the inner workings of CSS…

Thanks again for your support.

Please, make and attach completed demo based on your code snippets … leted_demo
Wi’lll try to help you

I thank you very much for your kind offer, but at the moment I’m already very happy with the way my project is coming along right now…
Could you please answer me another question though:

Is there a way to fire an event when the user changes the month? The user has not yet chosen a date on the new month, he is just viewing it…
I would like to do some proccessing on the dates of the month… i.e. I would like to set the holidays (like above). Is this possible somehow?

I know that I could do the proccessing all at once, but it would take too long and it would be wasted time if the user does not change the month at all…

Thank you!

Unfortunatelly, to handel the month changing is not supported.