473,973 Members | 13,524 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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&week ends=1&datestam p=20040
810

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

So far I did not succeed, any hints please?

Thanks in advance.

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

<!-- begin calendar -->
<SCRIPT LANGUAGE="JavaS cript">
<!-- Begin
title="javascri pt 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\?us erdir=calend\&d ept=boys\&weeke nds=1\">";
new_url="<a
href=\"/cgi-bin/calendar_day.pl \?userdir=calen d\&dept=boys\&w eekends=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=todayDa te.getDay();
thismonth=today Date.getMonth() ;
thisdate=todayD ate.getDate();
thisyear=todayD ate.getYear();
thisyear = thisyear % 100;
thisyear = ((thisyear < 50) ? (2000 + thisyear) : (1900 + thisyear));
if (((thisyear % 4 == 0)
&& !(thisyear % 100 == 0))
||(thisyear % 400 == 0)) monthdays[1]++;
startspaces=thi sdate;
while (startspaces > 7) startspaces-=7;
startspaces = thisday - startspaces + 1;
if (startspaces < 0) startspaces+=7;
document.write( "<table border=2 bgcolor=white ");
document.write( "bordercolor=bl ack>");

document.write( "<tr><th colspan=7 bgcolor=yellow> <font color=black><st rong>"
+ 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<startspa ces;s++) {
document.write( "<td></td>");
}
count=1;
while (count <= monthdays[thismonth]) {
for (b = startspaces;b<7 ;b++) {
if (count==thisdat e) {
document.write( "\n<td bgcolor=yellow> ");
}
else {document.write ("\n<td>");}
if (count==thisdat e) {
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==thisdat e) {
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 1618
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&week ends=1&datestam p=20040
810

<SCRIPT LANGUAGE="JavaS cript">
Deprecated. Use <script type="text/javascript">
new_url="<a
href=\"/cgi-bin/calendar_day.pl \?userdir=calen d\&dept=boys\&w eekends=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.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.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
3650
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 am trying to do. The ImageButton that is on the form handles its Command event just fine, but the ImageButton that is added to the cell does not handle the event. Am I doing something wrong, or is not possible to add server controls to a calendar...
0
1760
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 controls (i.e. roundedcorners component www.4guysfromrolla.com], buttons and panels) functions like a tab control. The buttons are programmatically designed to make the corresponding panel visible. Sample aspx.vb code:
2
3434
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 controls (i.e. roundedcorners component www.4guysfromrolla.com], buttons and panels) functions like a tab control. The buttons are programmatically designed to make the corresponding panel visible. Sample aspx.vb code:
0
1504
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 the mm/dd/yyyy format. I created a deployment package and installed the program on another server and it also returned the correct mm/dd/yyyy format. Recently I got complaints saying that the format changed to mm-dd-yyyy format. This...
0
4038
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 not set to an instance of an object" error, which points to the following line: lnkCalendar.Attributes("OnClick") = String.Format("window.open('Calendar.aspx?textbox={0}','cal','...')", txtEstimatedDeploy) Here is the complete code for the...
0
1728
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" OnClientClick= "window.open('Calendar.aspx', 'Calendar', 'menubar=no, location=no, personalbar=no, status=no, resizable=no, scrollbars=no, width=200, height=200');" />
1
2741
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" OnClientClick= "window.open('Calendar.aspx', 'Calendar', 'menubar=no, location=no, personalbar=no, status=no, resizable=no, scrollbars=no, width=200, height=200');" />
0
2024
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: 'this.container' is null or not an object
0
3341
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 would like to get the code for connecting the javascript to asp.net page... Please help me... The javascript code is as follows..
4
3395
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 the comments and clicks the save button then the date and the date will be stored in the mysql database. This is working fine. But my problem is when, after the user had made an entry the date in the calendar for which an entry has made should be...
0
10160
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11399
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10070
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8453
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7600
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6542
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5146
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4726
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3755
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.