Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Dynamic Table cell Hyper link

    Hi All,

    I tried to add links to open local xml files in browser in a dynamic table cells. I need help. I tried all ways but I think I miss something.
    I can open them without table just by document.write(xmlfile location).
    Here is my code. please help.
    function showResultsTable(searched, srchedname) {
    // get the reference for the body
    var mybody = document.getElementsByTagName("body")[0];

    // creates a <table> element and a <tbody> element
    mytable = document.createElement("table");
    mytable.setAttribute('id', 'resulttable');
    mytablebody = document.createElement("tbody");

    // creating all cells
    var mycurrent_cell = new Array();

    for(var j = 0; j < srchedname.length; j++) {
    // creates a <tr> element
    mycurrent_row = document.createElement("tr");

    mycurrent_cell[0] = document.createElement("td");
    currenttext = document.createTextNode(j);
    mycurrent_cell[0].appendChild(currenttext);
    mycurrent_row.appendChild(mycurrent_cell[0]);


    mycurrent_cell[1] = document.createElement("td");
    link = document.createElement("a");
    link.name = ""+srchedname[j]);
    link.href = "C:\\AAA\\TestCasesList.xml";
    mycurrent_cell[1].appendChild(link);
    mycurrent_row.appendChild(mycurrent_cell[1]);


    mycurrent_cell[2] = document.createElement("td");
    currenttext = document.createTextNode(searched[j]);
    mycurrent_cell[2].appendChild(currenttext);
    mycurrent_row.appendChild(mycurrent_cell[2]);

    // appends the row <tr> into <tbody>
    mytablebody.appendChild(mycurrent_row);
    }
    // appends <tbody> into <table>
    mytable.appendChild(mytablebody);
    // appends <table> into <body>
    mybody.appendChild(mytable);
    // sets the border attribute of mytable to 2;
    mytable.setAttribute("border", "2");

    }

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,537
    Thanks
    77
    Thanked 4,381 Times in 4,346 Posts
    ** duplicate post **

    already answered in prior thread.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

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