Creating a Calendar

Posted on 2003-02-25
Medium Priority
Last Modified: 2010-04-17
I need to make a calendar which is to be used in an ASP page.
I wat to know if :
1) I can use a Java Applet which displays the calendar alongwith my ASP page and if yes how do I pass information between the two??
2) If I want to create the calendar as a separate ASP page...can anyone get me the logic.

Question by:venky1981
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

aamironline earned 80 total points
ID: 8022752

       to create a calender for asp. the best way is to use javascript and dhtml. you can use java applet also but why do make page heavy by creating heavy java applets.

logic is as follows

- find the current year : year
- find the current month : month
- create the function to get the total no of days in the current month:daysInMonth()
- create a function getMonthByName() which wil return month name for month number.
- create a function dateClicked that will handle date clicked event
 - create function nextMonth() and prevMonth() which will set the current month.
- after getting all this data you are ready to draw calender.
- set ID of the body as doc
- web calender is nothing but its a normal html table

start creating table as following


var firstDate = new Date(year, month - 1,1);
var firstDay = firstDate.getDay();
var bStart = false;

var row = 6;
var col = 7;
var HTML = "";
///////////// Calender Heading
HTML += "<table border='0' style='border-collapse: collapse; border:1 solid #a9a9a9; ' bordercolor='#111111' width='150' height='125' bgcolor='white'>"

HTML += "<tr >"
HTML += "<td id='ArrowLeft' align=center height=10 style='border-bottom:1 solid #a9a9a9; background:#c0c0c0' width='17'><font face='Marlett' size='3'><a  href='#' onclick='prevMonth();return false' class='Arrow' onmouseMove='status=\"Previous Month\"'>3</a></font></td>"

HTML += "<td colspan=5 align=center height=10 style='border-bottom:1 solid #a9a9a9; background:#c0c0c0'>" + getMonthByName() + "</td>"

HTML += "<td align=center height=10 style='border-bottom:1 solid #a9a9a9; background:#c0c0c0' width='22'><font face='Marlett' size='3'><a href='#' class='Arrow' onclick='nextMonth();return false' onmouseMove='status=\"Next Month\"' >4</a></font></td>"

HTML += "</tr>"

    ////////////// Days Notations
    HTML += "<tr> "
    HTML += "<td width='17' height='10' bgcolor='#FFFFFF' class='daynotation'>S</td>"
    HTML += "<td width='17' height='10' bgcolor='#FFFFFF' class='daynotation'>M</td>"

    HTML += "<td width='16' height='10' bgcolor='#FFFFFF' class='daynotation'>T</td>"
    HTML += "<td width='16' height='10' bgcolor='#FFFFFF' class='daynotation'>W</td>"

    HTML += "<td width='16' height='10' bgcolor='#FFFFFF' class='daynotation'>T</td>"
    HTML += "<td width='16' height='10' bgcolor='#FFFFFF' class='daynotation'>F</td>"

    HTML += "<td width='22' height='10' bgcolor='#FFFFFF' class='daynotation'>S</td>"
     HTML += "</tr>"
     //////////////////// Calendar Calcuation Start ////////////////

     var counter = 0;
     for (row=0; row<6; row++)
          HTML += "<tr>"
          for(col=0; col<7; col++)
               if (firstDay == col && bStart == false)
                    bStart = true;

               if (bStart == false)
                    HTML += "<td>&nbsp;</td>";
                    HTML += "<td ><a class='date' href='#' onmousemove='status=\"" + getMonthByName(month) + " " + counter + ", " + year + "\"' onclick='dateClicked(counter); return false;' id='id" + counter + "'>" + counter + "</a></td>";
               if (counter >= daysInMonth())
          HTML += "</tr>"
          if (counter >= daysInMonth())
     HTML += "</table>";
     doc.innerHTML = HTML;



m aamir maniar


Expert Comment

ID: 9447508
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question