使用Jquery从页面中提取数据?

时间:2010-03-13 06:03:35

标签: jquery data-extraction

我想在动态网页上提取我无法通过Yahoo Pipe提供的所有ISBN(用户必须登录才能看到该页面)。有没有办法用jQuery做到这一点?怎么样?

修改 结构:

以下是该页面上HTML的示例。有一个<table>,其中包含一系列<tr>个元素。其中一个样本看起来大致如下:

<tr> 
  <td>(required/optional)</td>
  <td>LAFORE</td>
  <td>OBJECT ORIENTED PROGRAMMING IN C++ 4E</td>
  <td>9780672323089</td>
  <td>(course and section)</td>
  <td>(pricing information)</td>
</tr> 

其中任何一个都没有id属性,但结构定义明确。

谢谢!

1 个答案:

答案 0 :(得分:0)

//ideally provide better table selector if multiple tables are there
var isbns = $.makeArray($("table tr td:nth-child(4)"));
for(var i in isbns) {
  isbns[i] = isbns[i].innerHTML;
  alert(isbns[i]);
}
//now isbns is an array which contains all isbns found in the table
相关问题