Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8961245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:50:39+00:00 2026-06-15T15:50:39+00:00

Here in this , script is generating month’s HTML based on provided year and

  • 0

Here in this, script is generating month’s HTML based on provided year and month. In Demo, the default the day series is displayed like below

SUN - MON - ***** - FRI - SAT [0,1,2,3,4,5,6]

I want to make it customized provide day series manually like below

MON - TUE - ***** - SAT - SUN [1,2,3,4,5,6,0] 
or
SAT - SUN - ***** - THU - FRI [6,0,1,2,3,4,5,6] 

or whatever random day series provided etc..

But I am struck in the starting itself. Someone please provide me suggestions to handle this efficiently.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:50:40+00:00Added an answer on June 15, 2026 at 3:50 pm

    You can add a shift argument to the generateHTML(), Which will shift the week days shift days ahead.

    Calendar.prototype.generateHTML = function(shift) {
    
        shift = (shift || 0) % 7;
    
        // get first day of month
        var firstDay = new Date(this.year, this.month, 1);
        var startingDay = firstDay.getDay();
    
        if (shift > startingDay)
            shift -= 7;
    
        // find number of days in month
        var monthLength = cal_days_in_month[this.month];
    
        // compensate for leap year
        if (this.month == 1) { // February only!
            if ((this.year % 4 == 0 && this.year % 100 != 0) || this.year % 400 == 0) {
                monthLength = 29;
            }
        }
    
        // do the header
        var monthName = cal_months_labels[this.month]
        var html = '<table class="calendar-table">';
        html += '<tr><th colspan="7">';
        html += monthName + "&nbsp;" + this.year;
        html += '</th></tr>';
        html += '<tr class="calendar-header">';
        for (var i = 0; i <= 6; i++) {
            html += '<td class="calendar-header-day">';
            html += cal_days_labels[(i + shift + 7) % 7];
            html += '</td>';
        }
        html += '</tr><tr>';
    
        // fill in the days
        var day = 1;
        // this loop is for is weeks (rows)
        for (var i = 0; i < 9; i++) {
            // this loop is for weekdays (cells)
            for (var j = 0; j <= 6; j++) {
                html += '<td class="calendar-day">';
                if (day <= monthLength && (i > 0 || j + shift >= startingDay)) {
                    html += day;
                    day++;
                }
                html += '</td>';
            }
            // stop making rows if we've run out of days
            if (day > monthLength) {
                break;
            } else {
                html += '</tr><tr>';
            }
        }
        html += '</tr></table>';
    
        this.html = html;
    }
    

    If you want SAT - SUN - MON - ***** - FRI, you will need shift 1 day backward, which is generateHTML(-1).

    check out the demo.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I run this code here <html> <script type=text/javascript src=lib/jquery-ui-1.8.21.custom.min.js></script> <script src=http://127.0.0.1:5984/_utils/script/jquery.couch.js></script> <!--<script type=text/javascript src=lib/jquery-1.7.2.js></script>-->
Here are the problem scripts: This is from the HTML file: <script type=text/javascript> var
I think this script is of big interest to any noob around here :)
I really need some quick tips here. I've got this VBScript script which sends
I have this simple function: <script type=text/javascript> //<![CDATA[ jQuery(function($){ function here(b){alert(b);} ; here(6); });
Here is function , <script type=text/javascript> $(document).ready(function() { getRecordspage(1, 5); $(a.page-numbers).click(function() { alert(1); getRecordspage($(this).text(),
http://steph.net23.net/work.php here is my test link. This page has a jquery script in it
I am including jQuery in background_page like this, <script type=text/javascript src=libs/jquery.js></script> Here's the problem:
Trying to implement a search similar to here .This searches properties based on city,locality,property
This tutorial here is a good source of generating kml from the database using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.