|
Comments and Discussions
|
 |
 |
When I launch the demo page in I.E. 8, it works fine, but FireFox 4 give a message "There is a problem sending the command to the program."
You know what ol' Jack Burton says at a time like this...
|
|
|
|
 |
Hi DimondWolfe,
This script is rather old and I haven't revisited in a while, so I guess it probably has a few kinks to work out in newer browsers . I wrote an updated version for jQuery[^] - just confirmed that it also works in FF4. Hope that helps!
|
|
|
|
 |
Excellent! That is exactly what I'm looking for!
You know what ol' Jack Burton says at a time like this...
|
|
|
|
 |
Hello can anyone tell me please?
Depends of minDate how to rendar maxDate of cal2?
Means we are rendering two calendar..NOW IF user clicks on first that should be minDate of cal2 and also maxDate should be within range of 7.
Any answer will appreciate..
Help plz.
|
|
|
|
 |
Dear Karl Sir
No one has replied to my questions even you. So i was waiting. But now i solved it.
If need please let me know..!!
Thanks for the code
|
|
|
|
 |
First off, I'd like to say great work, you've saved me much time! I've gotten most of my mods to work (including having the events show up in a predefined div, rather than as an alert), but was wondering what JS code I would need to alter to have only the calendar appear? I'd like to have it without the input fields, and simply have the "next month" and "previous month" buttons. Is this possible?
|
|
|
|
 |
Hi, and thanks for your comment
The calendar is set to require at least one fallback input field. To get rid of the input fields, set the "fallback" property to 0 (It's called fallback_single in the script) and create a hidden field to pass to it. I'm afraid you'll still have to have that field in there, even if you're not actually doing anything with it.
<input type="hidden" id="tester" />
...
<script type="text/javascript">
cal1 = new Calendar ("cal1", "tester", new Date());
renderCalendar (cal1);
</script>
hth
|
|
|
|
 |
Thanks Karl, it should be fine with just the one input field, so I'll go with that. Again, great work!
|
|
|
|
 |
Thank u very much buddy for this amazing piece of work.It saved a lot of my time.
I've one question here....which date format shall I use to input the MinDate and MaxDate
values. My Idea is to restrict the user to select dates within this range only.
Or is there any way to do it?
|
|
|
|
 |
Hi, thanks for your message. Both minDate and maxDate take javascript Date objects, so you can just create a Date any way you like and pop it in there; the script will take care of the rest.
Example:
cal.maxDate = new Date();
hth
|
|
|
|
 |
First, I want to thank you for the code... It really help me...
Can we change the way to change the month ?? I want to use "Previous month" and "Next month" button instead of "typing" the date... If we can do that, how to make the existing text box and drop down list to be hidden ?? I tried some methods I know but it just make the calendar gone.
When people click on other date, the today's date no longer selected. How can we make today's date still selected ??
One more thing, how can I make Saturday NOT a holiday ??
Regards,
Ditya
modified on Tuesday, November 25, 2008 11:36 AM
|
|
|
|
 |
Hi Ditya... sorry for the delay in replying, somehow I missed the notification email.
For your questions:
- To make Saturdays count as a regular day, locate the following code in the script:
if ((currentDate.getUTCDay() == 0) || (currentDate.getUTCDay() == 6))
0 is Sunday, and 6 is Saturday - remove the condition for Saturdays to make Saturdays count as regular days.
- To avoid changing the date on click, remove the calls to selectDate in RenderDayEnabled and RenderDayEvent.
- Not sure what you mean about changing the way to change the month. You can set cal.scrollable = true to get the next and previous buttons. The calendar depends on the text boxes and drop downs, so you can't actually remove them; however I guess you could apply a display:none css class to them.
HTH
|
|
|
|
 |
Can anyone show/tell me how to go about doing the following to the calendar object so that when a certain day is clicked, it goes to a certain dynamic website.
User clicks a day, then a text file of data comes up corresponding to the day of the month they click on.
So far I know how to add the dates to the calendar object and make them appear blue with an underline, with this code:
cal1.eventDates = new Array(
new Array(curr_year + "/" + curr_month + "/" + curr_day, 1)
, new Array(curr_year + "/" + curr_month1 + "/" + curr_day1, 2)
Problem is that I need to make a loop so that 28 days back from the current date are underlined. I am having a lot of problems with that, I am not sure how to add a new sub array to an already exisiting Array. I was thinking of it in terms of putting the above code into one variable and putting the one variable like this:
cal1.eventDates = new Array(Back28Days); where Back28Days = new Array(Date, Counter), new Array(Date +1, Counter +1)); etc...
I think I got the event figured out to where if they click the day, it will open up a new windows with the data, I have a little work to do on the syntax of the window.open method, but I am also trying to display a dynamic webpage, here is an example:
http://......./ReportsFiles/Rep_(unique plant name)_1_(DayofMonth).txt
If there are any suggestiosn or help on any of this, mostly the first part, it would be much appreciated, thanks!
|
|
|
|
 |
Good evening Justin,
To make a day send the user to a page on click, modify the following function in the sample code:
<script type="text/javascript">
cal2 = new Calendar ("cal2", "tester2", new Date());
cal2.eventDates = new Array(
new Array("2005/2/10", 1)
, new Array("2005/2/12", 2)
, new Array("2005/2/14", 3)
);
myTextFiles = new Array();
myTextFiles['2005/2/10'] = "myfirstfile.txt";
myTextFiles['2005/2/12'] = "mysecondfile.txt";
myTextFiles['2005/2/14'] = "mythirdfile.txt";
cal2.scrolling = false;
cal2.selectEvent = function(eventId) { window.location = myTextFiles[eventId]; };
renderCalendar (cal2);
</script>
Re. Loops: I'm not sure why you would want to loop the way you described. The javascript would end up very large. You'd probably solve it more easily using some server side technology. Drop me a message if you have any questions
|
|
|
|
 |
Hello again,
Thanks for all your help, I understand the first part, I believe I was on the same track but using window.open instead, the way you suggested is definatley easier.
As for the loop I basically need it like the below code so that I have 28 new array objects inside the initial array. I, however, would not like to have 28 lines and so fourth to do this, instead I would rather have a loop that would increase the date and corresponding id number like I have below.
cal2.eventDates = new Array( new Array("2005/2/10", 1)
, new Array("2005/2/12", 2)
, new Array("2005/2/14", 3)
, new Array("2005/2/10", 4)
, new Array("2005/2/12", 5)
, new Array("2005/2/14", 6)
, new Array("2005/2/10", 7)
, new Array("2005/2/12", 8)
, new Array("2005/2/14", 9)
);
So I was thinking to make a variable TestDate = Test Date + new Array(Year, Month, Day, count), so that every time the loop went through it would add another new Array(Year, Month, Day, count), . So when I do the above code in my new setup I would have the following to include all of the subarrays:
cal2.eventDates = new Array(TestDate); This Test Date var would be equal to new Array(Date, Count) + new Array(Date, Count) etc...
But so far only the first "new Array(Date, Count)" works, and the rest do not. But your saying that it would be easier to use a JSP page or soemthing like that? I am not exactly sure how to interact JavaScript with that, any suggestions? Again thanks for all your help!!!
Justin
|
|
|
|
 |
Re: JSP - don't worry about that, I think I misunderstood what you wanted to do; a server side page would probably be overkill for the situation.
Try the following:
put this script block in the head for your page:
<script type="text/javascript" src="Calendar.js"></script>
<script type="text/javascript">
var uniquePlantName = "MYUNIQUEPLANTNAME";
var myTextFiles = new Array();
function SetupEvents(calendar, date, index)
{
var myDate = new Date(date);
for (var i = 0; i < 28; i++)
{
dateString = myDate.getFullYear() + "/" + (myDate.getMonth() +1) + "/" + myDate.getDate();
calendar.eventDates[calendar.eventDates.length] = new Array(dateString, index +i);
myTextFiles[dateString] = "http://whatever/ReportsFiles/Rep_" + uniquePlantName + "_1_(" + myDate.getDate() + ").txt";
myDate.setDate(myDate.getDate() -1);
}
}
</script>
Then put the following in the body:
<script type="text/javascript">
cal2 = new Calendar ("cal2", "tester2", new Date());
SetupEvents(cal2, "2008/10/29", 1);
cal2.scrolling = false;
cal2.selectEvent = function(eventId) { window.location = myTextFiles[eventId]; };
renderCalendar (cal2);
</script>
Both replace some html you should already have in your page.
As you can see in the SetupEvents function, all we have to do is use a for loop that will generate both the events and the links.
About the links: you might have a problem if your data spans more than one month, as the link only takes days into account. You might want to include the month (and year, if you need it) too.
HTH
|
|
|
|
 |
Thanks for all your help, I really appreciate it, the calendar works pretty much like I want it to, the only little thing I want to add to it is when the user clicks on a day that is underlined in the calendar (day with data), a new window appears with the data in it, but if the user goes back to the calendar page they cannot click on the same day they just clicked on without clicking off the day first, is there any easy way I can make it so that the user could click on the same day 1000 times. When the user goes back to the page they were on, the day is boldfaced, which is fine, but the user should be able to click on the day again and it bring up a file (if they accidendtally closed out of the data page).
For example the calendar object I am using has 28 days underlined in blue, in the calendar, to make an illlusion that a hyperlink is there. and there are 28 text files, 1 behind each day in an array like you showed me in a previous post. So if the user clicks a certain day that event ID will be the index of the array that holds the text files and it will open up that text file corresponding to the event ID that was clicked. If the user clicks today's date a text file will come up, showing the data the user needs, but if the user closes out of that window or tabs over to the calendar window and tries to click on the same day again, the link will not be there anymore. How can I get it so they could basically click all day on the same day and it would keep opening a file everytime they click.
Justin
|
|
|
|
 |
Try the following:
You can use the window.open(url, name) function (instead of setting window.location) in the event handler, to pop a window at the location of your file. If you specify the name of the window, the browser will use the same window if you click twice; if the window is not available, it will open a new one. The text file will still get reloaded, but at least, you won't get a few thousand windows running around.
To make the current date clickable, replace the lines in calendar.js containing
RenderDayEnabled (calendar, currentDate, calendar.todayDayStyle);
with
style = calendar.calendar.todayDayStyle
for (j=0; j < calendar.eventDates.length; j++)
{
if (calendar.eventDates[j][0] == currentDateString)
{
style = calendar.eventDayStyle;
RenderDayEvent (calendar, currentDate, style, calendar.eventDates[j][0]);
}
}
if (style == calendar.todayDayStyle)
{
RenderDayEnabled (calendar, currentDate, style);
}
There should be two instances of this; one at line 398 and one at line 414.
HTH
|
|
|
|
 |
Thank you so much, I really appreciate it, anything I can do like donations or anything let me know?
Justin
modified on Tuesday, November 4, 2008 2:58 PM
|
|
|
|
|
 |
i think t've understand what i want to know. Btw i have question for this sintax, onclick=\"selectDate(" + calendar.name + ", " + currentDate.getUTCDate() + "); " + calendar.name + ".selectEvent('" + eventId + "')\" , what will happen when this sintax operate?
modified on Tuesday, September 16, 2008 5:30 AM
|
|
|
|
 |
I don't understand the question. Could you explain what you mean please?
|
|
|
|
 |
Hi,
I am trying to change the looks of the calendar. Mainly colors...any help as to where i can find the style settings?
|
|
|
|
 |
Hi,
in the sample attached to this article, the styles are defined in the html header - cal_oddweek for the odd numbered weeks of the month, cal_evenweek for even numbered weeks, and so on. You can either replace the values in these classes, or modify the script so it attaches different class names to the elements. The best way to do this is to modify the following lines in the javascript file:
// The css classes for the calendar and header
this.calendarStyle = "cal_calendar";
this.headerStyle = "cal_header";
this.headerCellStyle = "cal_cell";
this.headerCellStyleLabel = "cal_labelcell";
// The css classes for the rows
this.weekStyle = "cal_week";
this.evenWeekStyle = "cal_evenweek";
this.oddWeekStyle = "cal_oddweek";
// The css classes for the day elements
this.dayStyle = "cal_day";
this.disabledDayStyle = "cal_disabled";
this.commonDayStyle = "cal_common";
this.holidayDayStyle = "cal_holiday";
this.eventDayStyle = "cal_event";
this.todayDayStyle = "cal_today";
Hope this helps
|
|
|
|
 |
this is a fine example of a date picker, but if you want a javascript event calendar, check out http://www.scriptcalendar.com
javascript calendar
|
|
|
|
|
 |
|
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
|
|