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 8031013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:57:20+00:00 2026-06-05T00:57:20+00:00

I have this code: /* Modify the footer row to match what we want

  • 0

I have this code:

/* Modify the footer row to match what we want */
var nCells = nRow.getElementsByTagName('th');
nCells[1].innerHTML = iPageCPSV;
nCells[2].innerHTML = iPageCGV;
nCells[3].innerHTML = iPagePPSV;
nCells[4].innerHTML = iPagePGV;

It works just fine as it is. However I have added another <tr> into the section now. And I am having trouble figureing out how to populate the <th> in the second <tr>

<tfoot>
    <tr style="background-color: #DDDDDD;">
        <th align="right" colspan="6">
            Page Total:
        </th>
        <th align="left"></th>
        <th align="left"></th>
        <th align="left"></th>
        <th align="left"></th>
    </tr>
    <tr style="background-color: #DDDDDD;">
        <th align="right" colspan="6">
            Downline Total:
        </th>
        <th align="left"></th>
        <th align="left"></th>
        <th align="left"></th>
        <th align="left"></th>
    </tr>
</tfoot>

Before I added the second <tr> with more <th> everything worked. It still works, I just don’t know how to populate the data into the second row. Can anyone help me modify the existing JavaScript or tell me how to duplicate it into jQuery?

  • 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-05T00:57:21+00:00Added an answer on June 5, 2026 at 12:57 am

    Without jQuery…

    var foot = nRow.getElementsByTagName('tfoot')[0];
    foot.rows[0].cells[1].innerHTML = iPageCPSV;
    foot.rows[0].cells[2].innerHTML = iPageCGV;
    foot.rows[0].cells[3].innerHTML = iPagePPSV;
    foot.rows[0].cells[4].innerHTML = iPagePGV;
    
    foot.rows[1].cells[1].innerHTML = iPageCPSV;
    foot.rows[1].cells[2].innerHTML = iPageCGV;
    foot.rows[1].cells[3].innerHTML = iPagePPSV;
    foot.rows[1].cells[4].innerHTML = iPagePGV;
    

    Or with…

    var foot = $('tfoot').first();
    
    foot.children().each(function(i, row) {
    
        row.cells[1].innerHTML = iPageCPSV;
        row.cells[2].innerHTML = iPageCGV;
        row.cells[3].innerHTML = iPagePPSV;
        row.cells[4].innerHTML = iPagePGV;
    });
    

    A more modern solution…

    var rows = nRow.getElementsByTagName('tfoot')[0].rows,
        data = [iPageCPSV, iPageCGV, iPagePPSV, iPagePGV];
    
    [].forEach.call(rows, function(el, i) {
        data.forEach(function(item, ii) {
            el.cells[ii + 1].innerHTML = item;
        });
    });
    

    Since you need different data for each cell, I’d suggest putting it all in an Array, getting a collection of all the elements, and pairing the two…

    var data = [iPageCPSV, iPageCGV, iPagePPSV, iPagePGV, 'foo', 'bar', 'baz', 'buz'];
    
    $('tfoot > tr > th:not(:first-child)').html(function(i, el) {
        return data[i];
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found this PHP code in an app I have to modify... $links =
I have this code for doing an ajax request to a webservice: var MyCode
I have this code: foreach (var item in ListView1.Items) { ListView1.Items.Remove(item); ListView21.Items.Add(item); } the
I have this code: function getTime(zone, success) { var url = 'http://json-time.appspot.com/time.json?tz=' + zone,
I have this code for a Dropdown menu: var timeout = 500; var closetimer
I have this asp.net code: @foreach( var database in Model) { if (!(firstTime ==
I have this code and I would like to modify it if possible to
I have this code var myObjects = {}; //global variable //Later on in the
I have this big code where I want 3 things in my search: 1-
I have this code about binary search tree , I want Calculated efficancy for

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.