justahobby
Nieuwe gebruiker
- Lid geworden
- 8 feb 2008
- Berichten
- 1
Hallo allemaal...
Ik ben bezig een mooi javascriptje te maken voor een kalender met links naar agenda punten. Dit doe ik zoals verwacht met het date object, maar ik krijg een dag verschil tussen mozilla en explorer. Hierbij zit mozilla "toevallig" goed en explorer er een dag naast.
Ik heb in de kalendar eerst de datum geplaats en vervolgens de dag en als laatste het jaar met dit als resultaat. Let hierbij op de datum bij de eerste dag van de maand.
Huidige tijd : Fri Feb 8 13:56:04 UTC+0100 2008
Eerste dag van de Maand : Fri Feb 1 13:56:04 UTC+0100 2008
februari M T W T F S S
1 5 2008 2 6 2008
3 0 2008 4 1 2008 5 2 2008 6 3 2008 7 4 2008 8 5 2008 9 6 2008
10 0 2008 11 1 2008 12 2 2008 13 3 2008 14 4 2008 15 5 2008 16 6 2008
17 0 2008 18 1 2008 19 2 2008 20 3 2008 21 4 2008 22 5 2008 23 6 2008
24 0 2008 25 1 2008 26 2 2008 27 3 2008 28 4 2008 29 5 2008
Dit werdt gegenereerd door het onderstaande script
Ik hoop dat iemand mij hiermee kan helpen, want ik ben uit gezocht.
Ik heb namelijk al de volgende dingen geprobeerd.
Bij explorer getday resultaat verlagen ect.
IK hoor graag van jullie...
P.s. In het weekend vanaf vrijdag 19:00 reageer ik niet (uitje)
Bijvoorbaat dank
Ik ben bezig een mooi javascriptje te maken voor een kalender met links naar agenda punten. Dit doe ik zoals verwacht met het date object, maar ik krijg een dag verschil tussen mozilla en explorer. Hierbij zit mozilla "toevallig" goed en explorer er een dag naast.
Ik heb in de kalendar eerst de datum geplaats en vervolgens de dag en als laatste het jaar met dit als resultaat. Let hierbij op de datum bij de eerste dag van de maand.
Huidige tijd : Fri Feb 8 13:56:04 UTC+0100 2008
Eerste dag van de Maand : Fri Feb 1 13:56:04 UTC+0100 2008
februari M T W T F S S
1 5 2008 2 6 2008
3 0 2008 4 1 2008 5 2 2008 6 3 2008 7 4 2008 8 5 2008 9 6 2008
10 0 2008 11 1 2008 12 2 2008 13 3 2008 14 4 2008 15 5 2008 16 6 2008
17 0 2008 18 1 2008 19 2 2008 20 3 2008 21 4 2008 22 5 2008 23 6 2008
24 0 2008 25 1 2008 26 2 2008 27 3 2008 28 4 2008 29 5 2008
Dit werdt gegenereerd door het onderstaande script
Code:
/*
Author M. Breedveld
Target:
Client-side calendar with links too activity's
Main Methode
- writeCalendar
- writes the calendar based on currentTime
- using the following methodes
- getNexMonth
- get's the next month with year
- based on currentTime
- getPreviousMonth
- get's the previous month with year
- based on currentTime
- isShortYear
- detirms if currentTime is short or long year with the answer false or true
- based on currentTime
- getActivity
- get's activity index or will return a false
- based on currentTime
- getMonthLenght
- detirms the lenght of current Month
- based on currentTime
Sub main methodes
- goNexMonth
- using the following methodes
- getNexMonth
- get's the next month with year
- based on currentTime
- goPreviousMonth
- using the following methodes
- getPreviousMonth
- get's the previous month with year
- based on currentTime
*/
//*******************************
// Variabelen declaratie
//date variables
var currentTime = new Date();
var months = new Array();
var shortMonths = new Array();
var days = new Array();
//Activity variables
var activityName = new Array();
var activityLink = new Array();
var activityDescryption = new Array();
var activityDate = new Array();
function loadVaribles(){
activityDate[0]= new Date();
activityDescryption[0]='Heeel leuk, kom dus';
activityLink[0]='www.fdcpartyclub.tk';
activityName[0]='Skien';
days[0]='Maandag';
days[1]='Dinsdag';
days[2]='Woensdag';
days[3]='Donderdag';
days[4]='Vrijdag';
days[5]='Zaterdag';
days[6]='Zondag';
shortMonths[0]='jan';
shortMonths[1]='feb';
shortMonths[2]='mrt';
shortMonths[3]='apr';
shortMonths[4]='mei';
shortMonths[5]='jun';
shortMonths[6]='jul';
shortMonths[7]='aug';
shortMonths[8]='sep';
shortMonths[9]='oct';
shortMonths[10]='nov';
shortMonths[11]='dec';
months[0]='januari';
months[1]='februari';
months[2]='maart';
months[3]='april';
months[4]='mei';
months[5]='juni';
months[6]='juli';
months[7]='augustus';
months[8]='september';
months[9]='october';
months[10]='november';
months[11]='december';
return true;
//document.write(days[0]);
//document.write(shortMonths [0]);
//document.write(months[0]);
}
//********************************
// Is functions do check something
function isShortYear(){
var shortYear=false;
if(currentTime.getFullYear()%400===0) {
shortYear = true;
} else if (currentTime.getFullYear() % 100 != 0 && currentTime.getYear % 4 == 0) {
shortYear=true;
}
return shortYear;
}
//********************************
//get function do return something
function getNexMonth(){
var month = 0;
month=currentTime.getMonth();
if (month<11){
month++;
} else {
month=0;
}
return month;
}
function getPreviousMonth(){
var month = 0;
month=currentTime.getMonth();
if (month>0){
month--;
} else {
month=11;
}
return month;
}
function getActivity(){
}
function getMonthLenght(){
var monthLenght = 0;
var currentMonth = currentTime.getMonth();
if (currentMonth != 1){
if(currentMonth%2===0 || currentMonth===0){
monthLenght = 31;
} else {
monthLenght = 30;
}
} else{
if (isShortYear() === true){
monthLenght = 28;
} else {
monthLenght = 29;
}
}
return monthLenght;
}
//***********************************
// The go functions moves the calendar
function goNexMonth(){
}
function goPreviousMonth(){
}
//Main Methode
function writeCalendar(){
loadVaribles();
var writtenDays= 0 ;
var tempTime = new Date();
tempTime.setYear(currentTime.getYear());
tempTime.setMonth(currentTime.getMonth());
tempTime.setDate(currentTime.getDate());
tempTime.setDate(1);
for(var a=0;a<7;a++){
document.write(days[a]+"<br />");
}
document.write("Huidige tijd : "+currentTime.toString()+"<br/>");
document.write("Eerste dag van de Maand : "+tempTime.toString()+"<br/>");
document.write(" <div id=\"calendar_wrap\">");
document.write(" <table summary=\"Calendar\">");
document.write(" <caption>");
document.write(" "+months[currentTime.getMonth()]);
document.write(" </caption>");
document.write(" <thead>");
document.write(" <tr>");
document.write(" <th abbr=\""+days[1]+"\" scope=\"col\" title=\""+days[1]+"\">M</th>");
document.write(" <th abbr=\""+days[2]+"\" scope=\"col\" title=\""+days[2]+"\">T</th>");
document.write(" <th abbr=\""+days[3]+"\" scope=\"col\" title=\""+days[3]+"\">W</th>");
document.write(" <th abbr=\""+days[4]+"\" scope=\"col\" title=\""+days[4]+"\">T</th>");
document.write(" <th abbr=\""+days[5]+"\" scope=\"col\" title=\""+days[5]+"\">F</th>");
document.write(" <th abbr=\""+days[6]+"\" scope=\"col\" title=\""+days[6]+"\">S</th>");
document.write(" <th abbr=\""+days[0]+"\" scope=\"col\" title=\""+days[0]+"\">S</th>");
document.write(" </tr>");
document.write(" </thead>");
document.write(" <tbody>");
document.write(" <tr>");
//A loop for a tabel 42 cells witch is max that a month uses
for(var writtenDate = 0 ; writtenDate < 35 ; writtenDate=writtenDate+6){
//A loop for rows of the table with 7 coloms witch are the days of the week
for(var writtenDay = 0 ; writtenDay < 7 ; writtenDay++){
/*if ((navigator.appName == "Microsoft Internet Explorer"){
if (tempTime.getDay()-1===writtenDay && writtenDays<getMonthLenght()){
document.write(" <td id=\"today\">"+tempTime.getDate()+" "+tempTime.getDay()+"</td>");
tempTime.setDate(tempTime.getDate()+1);
writtenDays++;
} else {
document.write(" <td> </td>");
}
}else {*/
if (tempTime.getDay()===writtenDay && writtenDays<getMonthLenght()){
document.write(" <td id=\"today\">"+tempTime.getDate()+" "+tempTime.getDay()+" "+tempTime.getFullYear()+"</td>");
tempTime.setDate(tempTime.getDate()+1);
writtenDays++;
} else {
document.write(" <td> </td>");
}
//}
}
document.write(" </tr>");
document.write(" <tr>");
}
document.write(" <tfoot>");
document.write(" <tr>");
document.write(" <td abbr=\""+months[getPreviousMonth()]+"\" colspan=\"3\" id=\"prev\"><button name=\"cmbVorige\" type=\"button\" onclick=\"goPreviousMonth();\">« "+shortMonths[getPreviousMonth()]+"</button> </td>");
document.write(" <td class=\"pad\"> </td>");
document.write(" <td abbr=\""+months[getNexMonth()]+"\" colspan=\"3\" id=\"next\"><button name=\"cmbVolgende\" type=\"button\" onclick=\"goNexMonth();\">"+shortMonths[getNexMonth()]+" »</button></td>");
document.write(" </tr>");
document.write(" </tfoot>");
document.write(" </tr>");
document.write(" </tbody>");
document.write(" </table>");
document.write(" </div>");
return true;
}
Ik hoop dat iemand mij hiermee kan helpen, want ik ben uit gezocht.
Ik heb namelijk al de volgende dingen geprobeerd.
Bij explorer getday resultaat verlagen ect.
IK hoor graag van jullie...
P.s. In het weekend vanaf vrijdag 19:00 reageer ik niet (uitje)
Bijvoorbaat dank