Results 1 to 8 of 8

Thread: Calendar js

  1. #1
    Join Date
    Aug 2008
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Calendar js

    I am Brazilian, and wanted to exchange the letters (s, m, t, w, t, f, s) by (s, t, q, q, s, s) in calendar js customers here. Can anyone help?

  2. #2
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    Post either a link to your page in which you have this Calendar script or the source code. We need to have something to work.

  3. #3
    Join Date
    Aug 2008
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by codeexploiter View Post
    Post either a link to your page in which you have this Calendar script or the source code. We need to have something to work.
    Link: http://www.sergiomr.mus.br

  4. #4
    Join Date
    Sep 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    that link doesn't work

  5. #5
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    In your page locate the following markup. You need to change it according to your requirements , I mean the highlighted values needs to be changed with your characters meant for day as you've mentioned in your first posting. But there is one problem in your posting you've furnished only 6 values and you need to have 7.

    Code:
    <tr align="center"><td class="daysofweek">S</td><td class="daysofweek">M</td><td class="daysofweek">T</td><td class="daysofweek">W</td><td class="daysofweek">T</td><td class="daysofweek">F</td><td class="daysofweek">S</td></tr>
    Hope this helps

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by codeexploiter View Post
    In your page locate the following markup. You need to change it according to your requirements , I mean the highlighted values needs to be changed with your characters meant for day as you've mentioned in your first posting. But there is one problem in your posting you've furnished only 6 values and you need to have 7.

    Code:
    <tr align="center"><td class="daysofweek">S</td><td class="daysofweek">M</td><td class="daysofweek">T</td><td class="daysofweek">W</td><td class="daysofweek">T</td><td class="daysofweek">F</td><td class="daysofweek">S</td></tr>
    Hope this helps
    It won't, there isn't anywhere on the page like that. The script generates that code. Here's the script (basiccalendar.js) with the section to edit highlighted:

    Code:
    function buildCal(m, y, cM, cH, cDW, cD, brdr){
    var mn=['January','February','March','April','May','June','July','August','September','October','November','December'];
    var dim=[31,0,31,30,31,30,31,31,30,31,30,31];
    
    var oD = new Date(y, m-1, 1); //DD replaced line to fix date bug when current day is 31st
    oD.od=oD.getDay()+1; //DD replaced line to fix date bug when current day is 31st
    
    var todaydate=new Date() //DD added
    var scanfortoday=(y==todaydate.getFullYear() && m==todaydate.getMonth()+1)? todaydate.getDate() : 0 //DD added
    
    dim[1]=(((oD.getFullYear()%100!=0)&&(oD.getFullYear()%4==0))||(oD.getFullYear()%400==0))?29:28;
    var t='<div class="'+cM+'"><table class="'+cM+'" cols="7" cellpadding="0" border="'+brdr+'" cellspacing="0"><tr align="center">';
    t+='<td colspan="7" align="center" class="'+cH+'">'+mn[m-1]+' - '+y+'</td></tr><tr align="center">';
    for(s=0;s<7;s++)t+='<td class="'+cDW+'">'+"SMTWTFS".substr(s,1)+'</td>';
    t+='</tr><tr align="center">';
    for(i=1;i<=42;i++){
    var x=((i-oD.od>=0)&&(i-oD.od<dim[m-1]))? i-oD.od+1 : '&nbsp;';
    if (x==scanfortoday) //DD added
    x='<span id="today">'+x+'</span>' //DD added
    t+='<td class="'+cD+'">'+x+'</td>';
    if(((i)%7==0)&&(i<36))t+='</tr><tr align="center">';
    }
    return t+='</tr></table></div>';
    }
    Just change the part:

    SMTWTFS

    to whatever you want it to be.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Aug 2008
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Sorry.
    The days of the week in Portuguese are: d, s, t, q, q, s, s.

  8. #8
    Join Date
    Aug 2008
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1 View Post
    It won't, there isn't anywhere on the page like that. The script generates that code. Here's the script (basiccalendar.js) with the section to edit highlighted:

    Code:
    function buildCal(m, y, cM, cH, cDW, cD, brdr){
    var mn=['January','February','March','April','May','June','July','August','September','October','November','December'];
    var dim=[31,0,31,30,31,30,31,31,30,31,30,31];
    
    var oD = new Date(y, m-1, 1); //DD replaced line to fix date bug when current day is 31st
    oD.od=oD.getDay()+1; //DD replaced line to fix date bug when current day is 31st
    
    var todaydate=new Date() //DD added
    var scanfortoday=(y==todaydate.getFullYear() && m==todaydate.getMonth()+1)? todaydate.getDate() : 0 //DD added
    
    dim[1]=(((oD.getFullYear()%100!=0)&&(oD.getFullYear()%4==0))||(oD.getFullYear()%400==0))?29:28;
    var t='<div class="'+cM+'"><table class="'+cM+'" cols="7" cellpadding="0" border="'+brdr+'" cellspacing="0"><tr align="center">';
    t+='<td colspan="7" align="center" class="'+cH+'">'+mn[m-1]+' - '+y+'</td></tr><tr align="center">';
    for(s=0;s<7;s++)t+='<td class="'+cDW+'">'+"SMTWTFS".substr(s,1)+'</td>';
    t+='</tr><tr align="center">';
    for(i=1;i<=42;i++){
    var x=((i-oD.od>=0)&&(i-oD.od<dim[m-1]))? i-oD.od+1 : '&nbsp;';
    if (x==scanfortoday) //DD added
    x='<span id="today">'+x+'</span>' //DD added
    t+='<td class="'+cD+'">'+x+'</td>';
    if(((i)%7==0)&&(i<36))t+='</tr><tr align="center">';
    }
    return t+='</tr></table></div>';
    }
    Just change the part:

    SMTWTFS

    to whatever you want it to be.
    I did it!
    Thank you for your help.
    I'm sorry I did not speak English well.

Bookmarks

Posting Permissions

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