问题标签 [document-body]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
336 浏览

html - Can use of HtmlAgilityPack be modified to only extract main part of HTML document?

I have some .NET code that ingests HTML files and extracts text from them. I am using HtmlAgilityPack to do the extraction. Before I wanted to extract most of the text that was there that was there, so it worked fine. Now requirements have changed and I need to only extract text from he main body of the document. So suppose I scraped HTML from a news webpage. I just want the text of the article, not the ads, titles of other albeit related articles, header/footers etc.

It is possible to modify my calls to HtmlAgilityPack to only extract the main text? Or is there an alternative way to do the extraction?

Here's the current block of code that gets text from HTML:

So, ideally, what I want is to let HtmlAgilityPack determine which parts of the input HTML constitute the "main" text block and input only those elements. I do not know what the structure of input HTML will be but I do know that it will vary a lot (before it was a lot more static)

0 投票
1 回答
447 浏览

css - HTML/CSS - 并排放置几个 DIV 元素,每个 div 是浏览器的 100% 宽度/高度

我无法弄清楚这一点,它可能相当简单。我有几个 DIV 元素需要并排放置(中间没有边距),并且每个 div 的设置宽度必须为浏览器宽度的 100%,最小高度为浏览器的 100%。

就像我说的那样,我确信有一个快速简便的技巧,我只是在我的研究中找不到太多。非常感谢!

更新:这似乎工作: http: //pastebin.com/kuQyfwuG

0 投票
1 回答
453 浏览

javascript - 是否可以将谷歌标签管理器添加到头部和身体

我想更多地利用 GTM。我已经设置它并使用<head>. 是否有可能拥有 2 个容器,1 个 for 和 1 个 for ,然后在每个相关容器中添加所有脚本?有没有其他方法可以做到这一点。

谢谢 :)

0 投票
2 回答
112 浏览

javascript - 转到下一页而不使用与索引页相同的标签

我正在尝试为我的页面编写一个 java 脚本函数。“index.html”页面的基本布局包含所有必要的标签(html、head、title 和 body)。我的问题是,我将如何进入下一页(如果您单击菜单项)而不必编写相同的标签并从“index.html”页面复制所有数据 - 即没有多余的代码。

例如,除了“index.html”页面之外,还有 3 个主页面(这个页面上有所有的主标签)。其他页面是 1-About 2-Contact 3-Gallery。在每个页面上,标签将只有:

呜呜呜

其他一些带有文字、照片等的标签

java脚本函数的代码是什么,可以更改标签内的文本/内容,而不必在每个页面上复制整个文档的代码?

我想使用 Chrome 作为默认浏览器,我只使用 HTML 和 Java 脚本(没有 PHP)

谢谢

0 投票
2 回答
46 浏览

javascript - Trying to refer to body in JSFiddle

I've always had some issues with JSFiddle and I'm not sure why, but I figure I should get them sorted out.

For one, I can't figure out how to reference the body element from JS Fiddle. Here's a screenshot of the problem:

enter image description here

It might be a little hard to see, but Firebug is giving a ReferenceError, saying that body is not defined. Nothing is printed in the result area.

Here's a live fiddle: http://jsfiddle.net/V4Mg6/.

EDIT: I'm an idiot. Thanks, guys.

0 投票
1 回答
76 浏览

html - FB 认为元标签在正文中

如果您点击此链接,您会看到第 3 行中不应该有一个段落标签

这是“导致”此的实际代码:

我不明白为什么会有一个段落标签取消元素并使FB相信元标签在正文中......你呢?

0 投票
1 回答
183 浏览

node.js - 如何在 Node.js 中获取 req.param 并获取正文?

我找到了这个例子来获取正文,但我怎样才能检索 req.param 变量?在这种情况下我没有 req ?!

更新

我像这样修改了方法签名,但是首先res.on不会被调用。

0 投票
1 回答
534 浏览

css - 为什么容器是身体的外部

为什么容器是身体的外部?我希望内容具有所有正文的 100% 宽度,而不是正文和标题。

这是我的CSS:

请帮我解决这个问题。:)

0 投票
3 回答
1039 浏览

javascript - html标签和正文之间的奇怪空白

我试图获得一个全屏图像背景,其中心有一个可滚动的 div,所以我写了这段代码:

使用相对 css:

结果似乎不错,但我注意到 html 标签和正文之间有一个奇怪的空白……我怎样才能避免这种行为?可能是什么原因?不幸的是,我对 Web 开发还很陌生,所以我什至不知道这是否是获得此布局的正确方法。有没有人有一些提示?

0 投票
0 回答
960 浏览

javascript - Chrome 扩展:如何将 div 附加为正文第一个子项?

我从几个小时就陷入了这个问题,我需要将我从 Javascript 文件创建的 div 附加为正文中的第一个子项。

我的manifest.js看起来是这样的:

这是我的contentscript.js的一部分

我试过这个:

但我没有得到任何结果。

任何帮助深表感谢。