Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

retrieve a cell value <td>

Status
Not open for further replies.

Proprieta85

Programmer
Sep 15, 2010
1
IT

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>
 
Not entirely sure what you are asking so apologies if I misunderstood.

But the only piece of javascript here, is the onClick="this.innerText=..."


Which basically changes the text of the link its in, to whatever was in your "Art" variable.

With that said, if you wanted to redirect to another page to show the entire article, I would remove the javascript and use the standard link with some ID of the article in question to use in the other page to run a query and retrieve the entire article.

Of course none of it is in any way Javascript related, as it would all be done with your server side language, which I believe is ASP VB. so perhaps asking in forum333 would be a better choice.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top