一些 If 语句、一些 html 调查和网络浏览器

发布于 2024-09-18 22:58:17 字数 820 浏览 3 评论 0原文

我有一个代码可以在此链接中单独检索所有“地名”和所有“地址”:

http://www.yellowpages.ca/search/si-geo/1/sh/Ottawa,+ON

我需要修改我的代码,以便它只检索placenameaddress(如果

<div class="address""> is not found within <div class="listingDetail"">

class="address" 是该位置的地址,class="listingDetail")是父级或容器。一些截图,请查看它们以便更好地理解:

http://i52.tinypic.com/67moog.png

http://i55.tinypic.com/289f7n.png

I have a code that retrieves all the "place names" and all the "addresses" separately in this link:

http://www.yellowpages.ca/search/si-geo/1/sh/Ottawa,+ON

I need to modify my code so that it will only retrieve the placename and address if

<div class="address""> is not found within <div class="listingDetail"">

class="address" is the address of the location, class="listingDetail" is the parent, or container. Some screenshots, please view them for better understanding:

http://i52.tinypic.com/67moog.png

http://i55.tinypic.com/289f7n.png

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

喜爱皱眉﹌ 2024-09-25 22:58:17

如果您使用 JavaScript,请使用:

var addresses = Array.filter( document.getElementsByClassName('listingDetail'), function(listingDetail){  
   return listingDetail.getElementsByClassName('address');  
 });

If you use javascript use:

var addresses = Array.filter( document.getElementsByClassName('listingDetail'), function(listingDetail){  
   return listingDetail.getElementsByClassName('address');  
 });
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文