如何在一个html文件中仅显示多个url的一部分?

发布于 2024-07-17 16:25:18 字数 1102 浏览 9 评论 0 原文

过去我使用 iframe,但它完整显示了所有网页 URL 内容。

例如:我已将以下代码保存在名为“Trial.html”的文件中:

<iframe src="http://stackoverflow.com/unanswered" width=1100 height=1500></iframe>
<iframe src="http://stackoverflow.com/questions" width=1100 height=1500></iframe>

当我在 Firefox 中加载文件“Trial.html”时,它会正确显示两个 URL。 ;)


但是,例如,我希望我的网页仅显示第一个网址的右上角“投票”部分(灰色)。 我注意到它有以下代码:

<div class="module">
        <div class="summarycount" style="text-align: left;">11,308</div>
        <p>questions with <b style="color: maroon;">no upvoted answers</b></p>

        <p>The highest voted unanswered questions appear first, then the most recent ones. </p>        
    </div>

是否可以仅显示部分

部分?

提前致谢;)

In the past I was using iframe but it displayed all the webpage urls contents in full.

For example: I have saved the following code in a file named "trial.html" :

<iframe src="http://stackoverflow.com/unanswered" width=1100 height=1500></iframe>
<iframe src="http://stackoverflow.com/questions" width=1100 height=1500></iframe>

When I load my file "trial.html" in firefox it shows the two urls properly. ;)


But, for instance, I would like that my webpage show me only the top right "vote" part (gray color) for the first url. I notice that it has the following code :

<div class="module">
        <div class="summarycount" style="text-align: left;">11,308</div>
        <p>questions with <b style="color: maroon;">no upvoted answers</b></p>

        <p>The highest voted unanswered questions appear first, then the most recent ones. </p>        
    </div>

Is it possible to display only the part <div class="summarycount" or the <div class="module"> part?

Thanks in advance ;)

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

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

发布评论

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

评论(2

孤独陪着我 2024-07-24 16:25:18

框架只是另一个视口,与基本浏览器窗口相同,视口所做的只是提供一个显示文档的位置。 整个文件。

如果您想解析一个文档或许多文档,选择其中的部分并合并到另一个文档中,则必须使用服务器端语言来加载这些文档并为您完成手术。 与往常一样,我建议使用 XSLT,因为文档格式良好,但每种语言都能够做到这一点。

如果你真的真的想要一个游击选项,如果你可以控制文档并且你没有x域的担忧,你可以做一些JS DOM操作来从iframe加载的文档中读取并复制将重要节点添加到父文档中,同时删除 iframe,但它并不干净或可靠。

Frames are just another viewport, same as your basic browser window, and all a viewport does is provide a place to display documents. Whole documents.

If you want to parse a document, or indeed many documents, to pick and choose sections of them and merge into another document, you'll have to engage a server-side language to load those documents up and do the surgery for you. As always, I recommend XSLT for this where the documents are well formed, but every language is capable of doing this.

If you really really wanted a guerilla option, IF you have control over the documents AND you don't have x-domain worries, you could do some JS DOM manipulation to read from iframe loaded documents and copy the important nodes into the parent document, deleting the iframe as you go, but it's nothing like as clean or reliable.

明媚殇 2024-07-24 16:25:18

我认为这也可以做到这一点(但恕我直言,对于 robots-no-follow html 文件网站来说,它不会做到这一点):

使用 Google Docs 构建网页监视器并自动跟踪更改
http://www.labnol.org /internet/monitor-web-pages-changes-with-google-docs/4536/

I think this can also do the trick (but it won't do it imho for robot-no-follow html file websites):

Build a Web Page Monitor with Google Docs and Track Changes Automatically
http://www.labnol.org/internet/monitor-web-pages-changes-with-google-docs/4536/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文