Tutorials | links in hypertext are one of their most important features, and users can jump directly from one page to another page, image, or server. The basic format for a link is as follows:
<a href= "Resource Address" > link text </A>
• Label <A> Indicates the beginning of a link,</a> the end of the link;
• Attribute "HREF" defines where the link refers;
• The specified file can be reached by clicking on "link text".
<a href= "http://www.sjstc.edu.cn" > China Shanxi window </A>
Links are divided into local links, url links, and directory links. Among the various elements of a link, the resource address is the most important, and once there is an error on the path, the resource cannot be obtained from the client.
Local Link:
**************
A connection to a different file on the same machine is called a local link, which uses the representation of a file path in a UNIX or DOS system, using an absolute or relative path to indicate a file.
For example: the absolute path of the page we are browsing now is: C:\study\HTML tutorial \link01.htm
This page is relative to the current directory, the HTML tutorial: link01.htm
If you are browsing a page outside of the HTML tutorial, the file path will be two dots (..) To represent the previous level of a directory:.. /.. /INTERNET/IP Address
Now we write the representations of these paths to the link:
In absolute path:<a href= "/c:\study\html tutorial \link01.htm" > File links </A>
Represented as a relative path:<a href= "link01.htm" > File links </A>
Link to file in previous directory:<a href= "... /.. /INTERNET/IP address ">ip address </A>
In general, we do not use the absolute path, because our resources are often placed on the internet for others to browse, written as an absolute path, when we put all the files in the entire directory to the server, with C:\ resource address users will not be able to access. So we'd better write a relative path to avoid the hassle of modifying the file resource path.
URL link
************
If the linked file is on another server, we need to find out which URL address to use when we point to the file. The URL means a Uniform Resource locator, through which information can be accessed through a variety of communication protocols.
URL link form is: protocol name://host. Domain name/path/filename
The agreements include:
File Local System files
HTTP www server
FTP FTP Server
Telnet based on Telnet protocol
mailto e-mail
News Usenet newsgroups
Gopher Gopher Server
WAIS WAIS Server
For example, we would like to express a URL address:
http://www.sjstc.edu.cn/
ftp://ftp.sjstc.edu.cn
telnet://bbs.xanet.edu.cn
Written in an HTML file, when you link to a file on another host, the format is as follows:
<a href= "http://www.sjstc.edu.cn/default.htm" > China Shanxi window </A>
<a href= "telnet://bbs.xanet.edu.cn" > Northwest Network Center terracotta Warriors station </A>
Directory Links
**************
The address of the resource mentioned above is simply pointing to a file, but the above method is not possible for directly pointing to the upper, lower, or central part of a file. However, we are not helpless to do so. We can use a directory link.
The way to make a directory link is:
• First set a paragraph as a link location, the format is: 〈a name= "link Location name" ></A>
• In the call to this link section of the file, define the connection: <a href= "FileName # Link Location name" > link text </A>
If you are jumping within a file, the filename can be omitted and not written.