this table dont have a id,class, i want get the content

<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td width="14%" height="25">FullName:</td>
<td width="86%">kannan</td>
</tr>
<tr>
<td height="25">email</td>
<td>kanna@sample.com</td>
</tr>
</tbody>
</table>

Recommended Answers

Hi,
You can do that using Javascript

//That give you all tables on page
//var tables = document.getElementByTagName("table");
//You must know how mutch tables are in page
//If this the first table on page you can use


var mytable = document.getElementByTagName("table")[0];
//Now the rows
var rows = mytable.getElementByTagName("td");
for(var i=0; …
Jump to Post

All 4 Replies

Hi,
You can do that using Javascript

//That give you all tables on page
//var tables = document.getElementByTagName("table");
//You must know how mutch tables are in page
//If this the first table on page you can use


var mytable = document.getElementByTagName("table")[0];
//Now the rows
var rows = mytable.getElementByTagName("td");
for(var i=0; i<rows.lenght; i++)
{
    //....do somthing with content
    alert(rows[i].innerHTML);
}
Member Avatar

Sounds as though you're scraping data from an external site. Otherwise, if its your data, just give an id attribute to the relevant tds.

yes i want to extract data from one website, tell the solution mr.diafol

Member Avatar

yes i want to extract data from one website

I don't understand. Are you extracting from your website or somebody else's website?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.