473,387 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Calendar html page

I found the script below in internet and I want it to create a page with
links for each date changing according to date. For example:

For August 10, the link in calendar page should point to:
/cgi-bin/calendar_day.pl?userdir=calend&dept=boys&weekends= 1&datestamp=20040
810

For August 11, the link in calendar page should point to:
/cgi-bin/calendar_day.pl?userdir=calend&dept=boys&weekends= 1&datestamp=20040
811

So far I did not succeed, any hints please?

Thanks in advance.

Webminor
-------
<html>
<head>
<title>Takvim</title>
</head>
<body bgcolor="#FFFFFF" link="#008000" vlink="#800040" text="#000000">

<!-- begin calendar -->
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
title="javascript for Calendar";
// if you comment url and un-comment new_url a click on any day links to
edit-day
// otherwise a click on any day simply brings up the whole calendar
// note - there are two places where this choice is made , see later in the
script
// CHANGE HERE!
//url="<a
href=\"/cgi-bin/calendar.pl\?userdir=calend\&dept=boys\&weekends=1 \">";
new_url="<a
href=\"/cgi-bin/calendar_day.pl\?userdir=calend\&dept=boys\&weeken ds=1\&date
stamp=thisyear\"";
monthnames = new Array(
"January",
"Februrary",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"Decemeber");
var linkcount=0;
function addlink(month, day, href) {
var entry = new Array(3);
entry[0] = month;
entry[1] = day;
entry[2] = href;
this[linkcount++] = entry;
}
Array.prototype.addlink = addlink;
linkdays = new Array();
monthdays = new Array(12);
monthdays[0]=31;
monthdays[1]=28;
monthdays[2]=31;
monthdays[3]=30;
monthdays[4]=31;
monthdays[5]=30;
monthdays[6]=31;
monthdays[7]=31;
monthdays[8]=30;
monthdays[9]=31;
monthdays[10]=30;
monthdays[11]=31;
todayDate=new Date();
thisday=todayDate.getDay();
thismonth=todayDate.getMonth();
thisdate=todayDate.getDate();
thisyear=todayDate.getYear();
thisyear = thisyear % 100;
thisyear = ((thisyear < 50) ? (2000 + thisyear) : (1900 + thisyear));
if (((thisyear % 4 == 0)
&& !(thisyear % 100 == 0))
||(thisyear % 400 == 0)) monthdays[1]++;
startspaces=thisdate;
while (startspaces > 7) startspaces-=7;
startspaces = thisday - startspaces + 1;
if (startspaces < 0) startspaces+=7;
document.write("<table border=2 bgcolor=white ");
document.write("bordercolor=black>");

document.write("<tr><th colspan=7 bgcolor=yellow><font color=black><strong>"
+ title + "<br>"
+ monthnames[thismonth] + " " + thisdate + ", " + thisyear
+ "</strong></font></th></tr>");

document.write("<tr>");
document.write("<td align=center><b><font color=red>Su</font></b></td>");
document.write("<td align=center>M</td>");
document.write("<td align=center>Tu</td>");
document.write("<td align=center>W</td>");
document.write("<td align=center>Th</td>");
document.write("<td align=center>F</td>");
document.write("<td align=center><b><font color=red>Sa</font></b></td>");
document.write("</font></tr>");
document.write("<tr>");
for (s=0;s<startspaces;s++) {
document.write("<td></td>");
}
count=1;
while (count <= monthdays[thismonth]) {
for (b = startspaces;b<7;b++) {
if (count==thisdate) {
document.write("\n<td bgcolor=yellow>");
}
else {document.write("\n<td>");}
if (count==thisdate) {
document.write("<font size=+1><strong>");
}
if (count <= monthdays[thismonth]) {
// CHANGE HERE!
//document.write(url + count + "</a>");
document.write(new_url + thisyear + thismonth + count + "\">" +
count + "</a>");
}
else {
document.write(" ");
}
if (count==thisdate) {
document.write("</strong></font>");
}
document.write("</td>");
count++;
}
document.write("</tr>");
document.write("<tr>");
startspaces=0;
}
document.write("<tr><th colspan=7 bgcolor=yellow><strong>"
+ "Click on a day"
+ "</strong></font></th></tr>");
document.write("</table></p>");
// End -->
</SCRIPT>
<!-- end calendar -->

</body>
</html>
Jul 23 '05 #1
1 1577
JRS: In article <2n************@uni-berlin.de>, dated Tue, 10 Aug 2004
20:50:11, seen in news:comp.lang.javascript, Hitit <hi****@gmx.net>
posted :
I found the script below in internet and I want it to create a page with
links for each date changing according to date.
It's not a good script; its author did not have a good understanding of
the language.

When posting code to news, it is the POSTER's duty to ensure that his
system does not, by line-wrapping, break the code. Readers should not
have to do this. <FAQENTRY>
For example:

For August 10, the link in calendar page should point to:
/cgi-bin/calendar_day.pl?userdir=calend&dept=boys&weekends= 1&datestamp=20040
810

<SCRIPT LANGUAGE="JavaScript">
Deprecated. Use <script type="text/javascript">
new_url="<a
href=\"/cgi-bin/calendar_day.pl\?userdir=calend\&dept=boys\&weeken ds=1\&date
stamp=thisyear\""; ^^^^^^^^^^ ------------------- REMOVE 10 charsmonthnames = new Array(
"January",
"Februrary",
There are better ways of spelling some of those months, and
monthnames = ["January", "February", ... "December"]
is simpler.

Use Mo We Fr, not M W F.

IIRC, CSS can be used to centre the cell contents.

if (count <= monthdays[thismonth]) {
// CHANGE HERE!
//document.write(url + count + "</a>");
document.write(new_url + thisyear + thismonth + count + "\">" +
count + "</a>");


document.write(new_url +
((thisyear*100 + thismonth)*100 + count) +
"\">" + count + "</a>");
^^^^^ ---- What's that meant to do ?
Read the FAQ (see below), etc., and you will learn much.

There may be an error in the code for positioning the 1st of the month
in the right column; test for another month, or make the week run in ISO
form, Mon..Sun.

To satisfy my copy of the validator TIDY, "</a>" should be "<\/a>"
"</td>" should be "<\/td>" and other cases of </ in strings likewise.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> JL / RC : FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Chuck Hartman | last post by:
I've been trying to add an ImageButton object to a Calendar table cell, but so far I am unable to handle the Command event from that button in my form's code behind. Below is an example of what I...
0
by: maxrawson | last post by:
First, let me start by saying my asp.net experience is still in it's infancy so please bare with me as I try to explain my situation. I have created a single page that with the use of many...
2
by: Caesar Augustus | last post by:
First, let me start by saying my asp.net experience is still in it's infancy so please bare with me as I try to explain my situation. I have created a single page that with the use of many...
0
by: GFro | last post by:
I have a calendar page that returns a date to a textbox on the parent page. It is returning the wrong format on the deployment server. On the development server the calendar returns to textbox in...
0
by: Wyatt70 | last post by:
I'm attempting to implement a javascript popup calendar in a DataGrid. The calendar will be used to insert a date into a textbox. I keep getting a "System.NullReferenceException: Object reference...
0
by: R.A.M. | last post by:
Hello, I need to implement popup calendar in ASP.NET application. I created a button opening popup calendar on 'master' page: <asp:Button ID="Calendar" runat="server" Text=Calendar"...
1
by: R.A.M. | last post by:
Hello, I need to implement popup calendar in ASP.NET application. I created a button opening popup calendar on 'master' page: <asp:Button ID="Calendar" runat="server" Text=Calendar"...
0
by: GV | last post by:
Hi all, New to developing in VS 2005 ASP 2.0 Trying to have a easy pop calender for a button on a web page. I keep getting a error message in IE6 that says: Line 69 Char 3 Error:...
0
by: mathewgk80 | last post by:
HI all, I am having popup calendar Javascript code. But i dont know how it is connecting to asp.net code.. I am using asp.net,c#.net and also using 3tier architecture with master page.... I...
4
by: gubbachchi | last post by:
Hi all, Please anybody help me solve this problem. I am stuck up with this from past 2 weeks. I am developing an application where, when the user selects date from javascript datepicker and enters...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.