我有以下div
<table>
<tbody>
<tr >
<td class="dvd_brdb">
<p class="PL10">
<a href="fdsf" class="bl_12"><b>APM Industries</b></a>
</p>
</td>
<td class="dvd_brdb">
<p class="PL30"><span>06-Nov-2015</span></p>
</td>
<td class="dvd_brdb">
<p class="PR20 FR">52.50</p>
</td>
<td class="dvd_brdb">
<p class="PR15 FR r_12">-0.94</p>
</td>
<td class="dvd_brdb">
<p class="PR15 FR">59.90</p>
</td>
<td class="dvd_brdb">
<p class="PR15 FR">32.55</p>
</td>
</tr>
<tr bgcolor="#f6f6f6">
<td class="dvd_brdb">
<p class="PL10">
<a href="jhg" class="bl_12"><b>Apollo Tyres</b></a>
</p>
</td>
<td class="dvd_brdb">
<p class="PL30"><span>30-Oct-2015</span></p>
</td>
<td class="dvd_brdb">
<p class="PR20 FR">190.95</p>
</td>
<td class="dvd_brdb">
<p class="PR15 FR gr_12">0.24</p>
</td>
<td class="dvd_brdb">
<p class="PR15 FR">249.45</p>
</td>
<td class="dvd_brdb">
<p class="PR15 FR">154.70</p>
</td>
</tr>
</tbody>
</table>
我正在尝试以Company Name
和Date
这样的方式阅读
$("tbody tr").each(function(){
var company_name = $(this).find("td").find(".PL10").find(".bl_12").text();
var date_res = $(this).find("td:eq(2)").find(".dvd_brdb").find(".PL30").text();
console.log(company_name);
console.log(date_res);
});
我可以获得company name
,但在获取date
方面遇到问题。
答案 0 :(得分:0)
Time [s] Offset_Angle observability_Analysis
0.00E+00 0.89040261167028E+00 0.00000000000000E+00
4.32E+02 0.21319658757004E+00 0.00000000000000E+00
8.64E+02 0.26803683992125E+00 0.00000000000000E+00
1.30E+03 2.67379011780784E+02 1.00000000000000E+00
1.73E+03 2.89704767087971E+02 1.00000000000000E+00
2.16E+03 2.93302157473406E+02 1.00000000000000E+00
这个选择器可以。
答案 1 :(得分:0)
当你这样做时
$(this).find("td:eq(2)")
结果已经td.dvd_brdb
。
所以,只需从.find(".dvd_brdb")
移除$(this).find("td:eq(2)").find(".dvd_brdb").find(".PL30").text();
即可。
答案 2 :(得分:0)
我更新您的代码,如下所示。
$("tbody tr").each(function(){
var company_name = $(this).find("td").find(".PL10").find(".bl_12").text();
var date_res = $(this).find("td:eq(1)").text();
console.log(company_name);
console.log(date_res);
});
答案 3 :(得分:0)
你可以尝试
Enumeration enumeration = NetworkInterface.getNetworkInterfaces();
NetworkInterface eth0 = null;
while (enumeration.hasMoreElements() {
eth0 = enumeration.nextElement()
if (eth0.getName().equals("eth0")) {
//there is probably a better way to find ethernet interface
break;
}
}
InetAddress group = InetAddress.getByName(IP);
MulticastSocket s = new MulticastSocket(PORT);
s.setSoTimeout(10000);
//s.joinGroup(group);
//this will throw "No such device" exception
s.joinGroup(new InetSocketAddress(group, PORT), eth0);
// this works just fine
for (int i = 0; i < 10; ++i) {
byte[] buf = new byte[8096];
DatagramPacket recv = new DatagramPacket(buf, buf.length);
s.receive(recv);
System.out.println("Recieved " + recv.getLength() + " bytes.");
}
s.leaveGroup(group);