...

View Full Version : Resolved birthdaylist problem



lucky927
09-24-2008, 10:21 PM
hi there
a time ago I found a codesnipped for a birthdaylist in this forum
I used it , but i wanted to change something and now it does'n t work anymore , what did i wrong
in this codesnippet the birthdays came in a list but I wanted to get them all behind each other

this is it now * Rene - 24 september (58)
* Doortje - 24 september (11)
* Fons - 24 september (68)
* Anneleen - 25 september (8)
* Berten - 26 september (14)
* Floor - 26 september (9)
* Daan - 28 september (8)
* Ingrid - 29 september (37)
* Louis - 30 september (8)

but I will something like this

Rene - 24 september (58) , Doortje - 24 september (11) , Fons - 24 september (68) , Anneleen - 25 september (8) , Berten - 26 september (14) , Floor - 26 september (9) , Daan - 28 september (8) , Ingrid - 29 september (37) * Louis - 30 september (8)

and with the code I changed I get this

true>Rene - 24 septembertrue>Doortje - 24 septembertrue>Fons - 24 septemberfalse>Anneleen - 25 septemberfalse>Berten - 26 septemberfalse>Floor - 26 septemberfalse>Daan - 28 septemberfalse>Ingrid - 29 septemberfalse>Louis - 30 september

here is the script with the wrong code : whats wrong ?

var arrBday = [
['Rene','09/24/1950'],['Anneleen','09/25/2000'],['Berten','09/26/1994'],['Doortje','09/24/1997'],['Floor','09/26/1999'],['Louis ','09/30/2000'],['Daan','09/28/2000'],['Ingrid','09/29/1971'],['Jos','10/05/1951'],['Kristel','10/01/1974'],['Zoe','10/11/1993'],['Floor','08/28/1992'],['Anne','10/01/1968'],['Fons','09/24/1940'],['Linda','02/09/1971']
//...and so on (last entry must not have a trailing comma)
];

function getBdayList(month){
var bday, idx;
var today = new Date();
var bdayList = new Array();
for (var i=0;i<arrBday.length;i++){
bday = new Date(arrBday[i][1]);
if (isNaN(bday)) continue;
if (month == bday.getMonth()){
idx = bdayList.length;
bdayList[idx] = new Object();
bdayList[idx].name = arrBday[i][0];
bdayList[idx].bday = bday;
bdayList[idx].age = today.getFullYear() - bday.getFullYear();
}
}
if (bdayList.length > 0){ //sort asc by birthdate
bdayList.sort(
function(a, b){
if (a.bday.getDate() < b.bday.getDate()) return -1;
if (a.bday.getDate() > b.bday.getDate()) return 1;
return 0;
}
);
}
return bdayList;
}

function displayBdayList(){
var arrMonth = new Array("januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december");
var month = new Date().getMonth();
var date = new Date().getDate();
var monthName = arrMonth[month];
var bdayList = getBdayList(month);
var len = bdayList.length;
var s = "Jarig in de maand " + monthName + "";
if (len>0){
s += '<ul>';
for (var i=0; i<len; i++){
//no age
s += (date == bdayList[i].bday.getDate()) + '><strong>' + bdayList[i].name + "</strong> - " + bdayList[i].bday.getDate() + " " + monthName ;

}
s += '</ul>';
}
else{
s += "No birthday celebrant for this month.";
}
document.write(s);
}

displayBdayList();

jmrker
09-25-2008, 04:06 AM
Try changing: s += '<ul>';
to s += '<span>';
and:s += '</ul>';
to s += '</span>';

I think this tag output the items part of a list.
Just a guess. :o

ninnypants
09-25-2008, 04:36 AM
Try changing: s += '<ul>';
to s += '<span>';
and:s += '</ul>';
to s += '</span>';

I think this tag output the items part of a list.
Just a guess. :o

That should be all it takes though I don't see why you page doesn't display them inline since I cannot see them being placed in "li"'s anywhere

lucky927
09-25-2008, 06:15 PM
thanks guys

now it works great

grtz Lucky927



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum