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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:36:25+00:00 2026-05-23T17:36:25+00:00

I am setting up some basic pagination of a table, and I have the

  • 0

I am setting up some basic pagination of a table, and I have the following JS function:

function AddPagination() {
    var paginationDiv = document.getElementById("pagination");
    for (i = 0; i < 3; ++i) {
        var page = document.createElement("a");
        page.innerHTML = i + 1;
        page.setAttribute("title", i + 1);
        page.setAttribute("href", "javascript:RenderResultTable(this.innerHTML)");
        paginationDiv.appendChild(page);
    }
}

What I want to do is pass page number clicked on to the RenderResultTable method. I have this number stored as the innerHTML and title for the link element, how can I get this passed through using the above code?

Thanks.

  • 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-05-23T17:36:26+00:00Added an answer on May 23, 2026 at 5:36 pm

    Personally, I wouldn’t use JavaScript for pagination but if that’s the way you want to go, you need to use some string concatenation. I’m not sure what RenderResultTable() does but you can set that line up like this:

    page.setAttribute("href", "javascript:RenderResultTable('" + page.innerHTML + "')");
    

    I believe that should do the trick.

    EDIT: Shouldn’t you be using i++ in your loop instead of ++i? I think what you have right now will give 2 as the first page number. Please correct me if I am wrong.

    EDIT: page.innerHTML will need to be escaped by this functions and then unescaped the in the RenderResultTable() function. escape() and unescape(). This is to prevent JavaScript injections and/or accidental bugs.

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

Sidebar

Related Questions

I am developing some basic html pages, i am setting colors of text usimg
I am using the jQuery Tablesorter 2.0 plugin to provide some basic table sorting
I have an ASP.NET application that is fairly basic. It queries some data and
I have a pretty basic question. In some examples I've seen, objects are just
I have some code that is used to replace certain page output with other
I have implemented basic syntax highlighting by properly setting the NSTextStorage delegate of my
I have setup some basic code that triggers on focus of various input fields:
A random class definition: class ABC: x = 6 Setting some values, first for
I'm setting up some monitoring on a few SQL Servers. Currently our environment uses
I'm setting up some VBA in excel to compare two dates to see if

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.