三、HTML中的name屬性:
The name attribute is used to create a named anchor. When using named anchors we can create links that can jump directly into a specific section on a page, instead of letting the user scroll around to find what he/she is looking for.
You should notice that a named anchor is not displayed in a special way.To link directly to the "tips" section, add a # sign and the name of the anchor to the end of a URL.
<a name="tips">Useful Tips Section</a>
備注:
一個被錨標記標注的文本并不會有什么特別的顯示,要想使用錨標記進行頁間跳轉,只需要在URL的末尾加上一個#號和錨標記的名稱就可以了。如果是進行頁內跳轉則簡單地使用#號加錨標記的名稱就可以了(連URL都不用了)。
<a >
Jump to the Useful Tips Section
</a>
<a href="#tips">Jump to the Useful Tips Section</a>
四、關于超鏈接的一些注意點:
Always add a trailing slash to subfolder references. If you link like this: , you will generate two HTTP requests to the server, because the server will add a slash to the address and create a new request like this:
Named anchors are often used to create "table of contents" at the beginning of a large document. Each chapter within the document is given a named anchor, and links to each of these anchors are put at the top of the document.
If a browser cannot find a named anchor that has been specified, it goes to the top of the document. No error occurs.