使用url查询字符串跳转到页面部分

TAR*_*KUS 3 html anchor hyperlink

标准教程教授如何使用hashtag和锚名称链接到页面部分,如下所示:

<li><a href="#section2">Section 2</a></li>

<h1>Title</h1>

<a name="section1"></a><h2>Section 1</h2>
<p>Blah bla bla bla bla.</p>

<a name="section2"></a><h2>Section 2</h2>
<p>Blah bla bla bla bla.</p>
Run Code Online (Sandbox Code Playgroud)

如何使用完全限定的URL将页面链接嵌入页面部分?例如:

<a href="http://www.mydomein.com/page1?section=section2">Please read section 2</a>
Run Code Online (Sandbox Code Playgroud)

该应用程序是一个注册通知电子邮件.

And*_*ion 9

使用您的示例,链接将是:

<a href="http://www.mydomein.com/page1#section2">Please read section 2</a>
Run Code Online (Sandbox Code Playgroud)

另请注意,这<a name="section2"></a>是多余的.你可以简化到

<h2 id="section2">Section 2</h2>
Run Code Online (Sandbox Code Playgroud)