Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Sep 2008
    Location
    Kalmthout , Belgium
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question birthdaylist problem

    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();
    Last edited by lucky927; 09-25-2008 at 05:24 PM.

  • #2
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,065
    Thanks
    36
    Thanked 498 Times in 492 Posts

    Arrow Something to try ...

    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.

  • Users who have thanked jmrker for this post:

    lucky927 (09-25-2008)

  • #3
    Regular Coder ninnypants's Avatar
    Join Date
    Apr 2008
    Location
    Utah
    Posts
    504
    Thanks
    10
    Thanked 47 Times in 47 Posts
    Quote Originally Posted by jmrker View Post
    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.
    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

  • #4
    New to the CF scene
    Join Date
    Sep 2008
    Location
    Kalmthout , Belgium
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts
    thanks guys

    now it works great

    grtz Lucky927


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •