retrieve a cell value <td>

Discussion in 'JavaScript' started by proprieta, Sep 15, 2010.

  1. #1
    Hi guys can help me are very little versed in javascript ... I explain my problem!
    I have a table where they passed the results of a query ...
    The table field is called Article and consists of about 500 characters, but the substring in the table with a step the first 40 characters, and now the question arises ... I would click on the text of the article and see the page the entire article ...
    
    query="SELECT * FROM Articolo ORDER BY titolo DESC";
    ResultSet r = stmt.executeQuery(query);
    %>
    <table border="1">
    <tr><td> titolo </td> <td> articolo </td> <td> data inser </td></tr>
    <%
    while(r.next())
    {
    Tot = r.getString("titolo");
    Art = r.getString("articolo");
    dat = r.getString("data_inserimento");
    String meta = "";
    String metadata = "";
    meta = Art.substring(0,40);
    metadata = dat.substring(0, 10);
    StringBuffer sb = new StringBuffer(meta);
    sb.replace(37,40, "...");
    String s2 = sb.toString();
    
    %>
    <tr>
    <td> <%= Tot %> </td>
    <td> <a href="#" onClick="this.innerText = '<%= Art %>';"><%= s2 %></a> </td>
    <td> <%= metadata %> </td>
    </tr>
    
    
    <%
    }
    %>
    </table>
    
    Code (markup):
    [​IMG]
     
    proprieta, Sep 15, 2010 IP
  2. DomainCo.US

    DomainCo.US Well-Known Member

    Messages:
    2,124
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    100
    #2
    you need to have a key that you will use in your anchor, then when clicked query using the key
     
    DomainCo.US, Sep 15, 2010 IP
  3. proprieta

    proprieta Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    do you can this code?
     
    proprieta, Sep 15, 2010 IP
  4. WWSD

    WWSD Peon

    Messages:
    28
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You can go through the elements using the DOM or using Jquery elements
     
    WWSD, Sep 19, 2010 IP