node2:/var/www/html/jquery#cat a11.html
<html>
<body>
<div class="one" id="one">id为one,class为one的div</div>
<div class="twozhaoyangjian" id="two">id为two,class为two的div</div>
<div class="mini">class为mimi</div>
<p>第一个P标签,乔丹</p>
<p>第二个P标签,科比</p>
</body>
<script type="text/javascript" src="jquery-2.2.2.min.js"></script>
<script type="text/javascript" src="a11.js"></script>
</html>
node2:/var/www/html/jquery#cat a11.js
var item=$("p");//获取id为tn的元素(table);
console.log(item);
[root@node01 jquery]# cat data.html
<html>
<body>
<div class="one" id="one">id为one,class为one的div</div>
<div class="twozhaoyangjian" id="two">id为two,class为two的div</div>
<div class="mini">class为mimi</div>
<p>第一个P标签,乔丹</p>
<p>第二个P标签,科比</p>
</body>
<script type="text/javascript" src="jquery-2.2.2.min.js"></script>
<script type="text/javascript" src="a11.js"></script>
</html>
[root@node01 jquery]# cat a2.pl
use LWP::UserAgent;
use DBI;
use POSIX;
use Data::Dumper;
use HTML::TreeBuilder;
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
$ua->agent("Mozilla/8.0");
use HTML::TreeBuilder::XPath;
$tree= HTML::TreeBuilder::XPath->new;
$tree->parse_file( "data.html");
my @queue= $tree->findvalues('//p');
print @queue;
print "
";
[root@node01 jquery]# perl a2.pl
第一个P标签,乔丹第二个P标签,科比