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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:56:10+00:00 2026-06-11T15:56:10+00:00

I am new here with very limited knowledge on programming. I just use whatever

  • 0

I am new here with very limited knowledge on programming. I just use whatever I find from the web and expirement on them. Let me explain how I meant.

I have a database text file that looks like this.

colh01|colh02|colh03|colh04|colh05|
data11|data12|data13|data14|data15|
data21|data22|data23|data24|data25|
data31|data32|data33|data34|data35|
data41|data42|data43|data44|data45|

Now I used the javascript I found in the web to display the contents to a table.

<script type="text/javascript">
onload = function () {
    if (!document.getElementById || !document.getElementsByTagName)
        return;
    var frm = null, 
    prenode,
    tbod = document.getElementById('tbod'),
    data = '';
    if ((frm = top.frames['buffer']) //iframe
         && frm.document) { //get <pre> parent
        prenode = frm.document.getElementsByTagName('pre').item(0);
        if (null != prenode
             && null != prenode.firstChild
             && /#text/.test(prenode.firstChild.nodeName)) //text node
        {
            data += prenode.firstChild.data; //read
            data = data.split(/[\n\r]/); //separate lines
            data.splice(0, 0); //lose first two (legend)
            var i = 0,
            l = data.length, rowdata, ii, ll, tr, td;
            for (; i < l; ++i) {
                tr = document.createElement('tr'); //new row
                tbod.appendChild(tr);
                rowdata = data[i].split("|", 6); //separate bits
                for (ii = 0, ll = rowdata.length; ii < ll; ++ii) {
                    td = document.createElement('td'); //new cell
                    td.appendChild(document.createTextNode(rowdata[ii]));
                    tr.appendChild(td);
                }
            }
        }
    }
}

</script>

It works fine and the output looks like this.

colh01  colh02  colh03  colh04  colh05
data11  data12  data13  data14  data15
data21  data22  data23  data24  data25
data31  data32  data33  data34  data35
data41  data42  data43  data44  data45

Then I wanted to insert a column (colh6) that will have data taken from first column. It should look like this

colh01  colh02  colh03  colh04  colh05  colh6 (new column)-->(link to file)
data11  data12  data13  data14  data15  'file-<data11>.pdf' -->(href='http://locahost/file-<data11>.pdf')
data21  data22  data23  data24  data25  'file-<data21>.pdf' -->(href='http://locahost/file-<data21>.pdf')
data31  data32  data33  data34  data35  'file-<data31>.pdf' -->(href='http://locahost/file-<data31>.pdf')
data41  data42  data43  data44  data45  'file-<data41>.pdf' -->(href='http://locahost/file-<data41>.pdf')

How do I go about this? The data is a hyperlink that user can click to open the file.

  • 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-11T15:56:11+00:00Added an answer on June 11, 2026 at 3:56 pm

    You’ve completed the hard part, all you’re missing is how to create a link using Javascript. If you just add these lines after your loop, it will create a link using the content of the first column;

    var newlink = document.createElement('a');
    newlink.setAttribute('href', 'http://localhost/file-' + rowdata[0] + '.pdf');
    newlink.appendChild(document.createTextNode('Link text'));
    td = document.createElement('td');
    td.appendChild(newlink);
    tr.appendChild(td);
    

    More info on creating dynamic links here.

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

Sidebar

Related Questions

I'm still very new at programming, and our local SSIS genius isn't here today
I have a questions here about MySQL replication. I have a very limited knowledge
Very new mobile developer here... I am trying to retrieve a list of tweets
I'm new at Eclipse and the Android applications making so here comes a very
Pretty new to Perl so there may be a very obvious solution here. I'm
I'm very new to C#, so please forgive me if I've overlooked something here.
I am very new to Perl, so please bear with my simple question: Here
new to programmation, im learning and here is probably a very simple problem for
I'm new to IDEA, but very familiar with Eclipse. I followed the instructions here
I know it sounds very basic, but I am new to Javascript. Here is

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.