vic*_*ico 3 browser internet google-chrome links
假设我有网页http://www.albahari.com/threading/,其中包含许多文本和文章。文章名称之一是Thread Pooling。我想将我的朋友链接发送到特定的这篇文章,而不是从一开始就发送整个页面。我想构建一个链接,Thread Pooling在点击它后,在浏览器中向下滚动页面到微粒文章。如何做到这一点?如何在网页中找到可用的直接链接?
例如,转到有关“线程池”的文章,请使用以下链接:
http://www.albahari.com/threading/#_Thread_Pooling
Run Code Online (Sandbox Code Playgroud)
通常,查找具有id属性的 HTML 元素,或者在缺少该name属性的情况下,在您想要的文章顶部的锚标记的属性中查找并使用它,如上所述,在#URL 之后。
该特定文章开头附近的 html 如下所示:
<h1>
<a name="_Thread_Pooling">Thread Pooling</a>
</h1>
<p>Whenever you start a thread, a few hundred microseconds
are spent organizing such things as a fresh private local variable stack. Each
thread also consumes (by default) around 1 MB of memory. The <i>thread pool</i> cuts these overheads by sharing and
recycling threads, allowing multithreading to be applied at a very granular
level without a performance penalty. This is useful when leveraging multicore
processors to execute computationally intensive code in parallel in
“divide-and-conquer” style.</p>
Run Code Online (Sandbox Code Playgroud)
在上面,我们可以看到:
<a name="_Thread_Pooling">
Run Code Online (Sandbox Code Playgroud)
这告诉我们用于标识该文章开头的字符串。这是我们在指向该文章的 URL 中使用的内容。
正如grawity指出的,name在 HTML4 中工作的 ,HTML5 不支持。id应改用该属性。 id可用于任何 HTML5 元素,而不仅仅是锚点。
| 归档时间: |
|
| 查看次数: |
182 次 |
| 最近记录: |