Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 181293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:44:16+00:00 2026-05-11T14:44:16+00:00

I have the code for a javascript calendar and it works perfectly as it

  • 0

I have the code for a javascript calendar and it works perfectly as it creates it when the page loads. However I was wondering if it’s possible to add events to it. I found a plugin (jQuery) that enables the user to hover over a td with class ‘event’ and an event will be displayed. So since this calendar will not be used by me but by someone else who knows nothing about developing I was wondering if there is a way to make a php file or upload or something so she can upload the event. I mean, let’s say she wants an event on the 3rd then she uploads a file php reads it and tells javascript to add the class ‘event’ that date and jQuery does the rest. Is it possible? I can’t even figure out how to do it and I really hope I explained myself. Here’s my javascript btw.

function buildCal(){     var d = new Date();     var month = d.getMonth()+1;     var year = d.getFullYear();     var monthName=['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'];     var daysInMonth=[31,0,31,30,31,30,31,31,30,31,30,31];      var objectDay = new Date(year, month-1, 1); //fix date bug when current day is 31st     objectDay.od=objectDay.getDay()+1; //fix date bug when current day is 31st      var todaydate=new Date()      var scanfortoday=(year==todaydate.getFullYear() && month==todaydate.getMonth()+1)? todaydate.getDate() : 0 //DD added      daysInMonth[1]=(((objectDay.getFullYear()%100!=0)&&(objectDay.getFullYear()%4==0))||(objectDay.getFullYear()%400==0))?29:28;      var t='<div class='main'><table class='main' cols='7' cellpadding='0' border='0' cellspacing='0'>';     t+='<h3 class='monthCSS' align='center'>'+monthName[month-1]+' - '+year+'</h3><tr align='center'>';       for(s=0;s<7;s++)t+='<td class='daysofweek'>'+'DoLuMaMiJuViSa'.substr(s*2,2)+'</td>';      t+='</tr><tr align='center'>';     for(i=2;i<=42;i++){         var x=((i-objectDay.od>=0)&&(i-objectDay.od<daysInMonth[month-1]))? i-objectDay.od+1 : '&nbsp;';             if (x==scanfortoday)                 x='<td class='today'>'+x+'</td>'             t+='<td class='days'>'+x+'</td>';         if(((i)%7==0)&&(i<36))t+='</tr><tr align='center'>';     }     return t+='</tr></table></div>'; } 

Something else, as you can see here, it adds blankspaces until it gets to an actual date. I was trying to make it check if(x was not a number) then add a td class=’padding’ however to do this I was trying to use x.match(/[0-9]+/) but it didn’t seem to work and it would also be the first time I try to use regex with javascript would anyone know why is that wrong? or how to actually check for it?


Edit

Something odd is happening with this script and I don’t know why, I tried to change from

t+='<td class='days'>'+x+'</td>'; 

to

t+='<td class='days' + x +''>'+x+'</td>'; 

this, so I could select each td, but when I do this a new td is generated which contains

<td id='days&lt;td class=' today=''>1</td> 

I have NO idea why this happens, I just know it is messing with the code because afterwards I get a ‘> printed (because of quotes mis-match caused by this new td…why is this happening?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T14:44:17+00:00Added an answer on May 11, 2026 at 2:44 pm

    The calendar systems I’ve created use a full php array of the month. so that you can iterate over it and for every corresponding blank day table cell there is a blank array for the day.

    e.g.

    $calendar_dates = array(               [week_1] = array(                      [sun] = Null                      [mon] = NULL                      [tue] = array(                             [events] = array(                                     event_id => 'event name'                                     event_name => ''                                     event_time => ''                              )                      [wed]                      ...                  )               [week_1] => array()               ...........   ) 

    I build the days array by just creating an array from the specified date and current week

    then I hit the databse to get events in that range

    then cycle through the events and attatch them to the calendar array.

    works like charm.

    To get it to work with javascript just have it echo some specific javascript in the head of the html file that control the opening and closing of the calendar days.

    give you client a simple login page to input/edit events in a webform.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 104k
  • Answers 104k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If it helps, I recently wrote an article on my… May 11, 2026 at 8:32 pm
  • Editorial Team
    Editorial Team added an answer If the type being used is defined in choicepointClue.dll, it… May 11, 2026 at 8:32 pm
  • Editorial Team
    Editorial Team added an answer schema.rb is the Ruby schema format and it doesn't support… May 11, 2026 at 8:32 pm

Related Questions

I've got a .net calendar up and running and bringing information from a database.
Well, I guess this day had to come. My client's website has been compromised
I'm developing a Django application that contains a model with a date/time field. On
This is a good candidate for the Works on My Machine Certification Program .

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.