Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.sao.ru/cats/~satr/JS/REF/tags7.htm
Дата изменения: Thu Mar 26 16:45:00 1998 Дата индексирования: Tue Oct 2 05:24:28 2012 Кодировка: Поисковые слова: accretion disk |
Do not nest an anchor within another A tag.
Syntax
<A
NAME="anchorName
"
>
...
</A> Example
<A NAME=section2>
If this anchor is in a file called "nowhere.htm," you could define a link that jumps to the anchor as follows:
<H2>A Cold Autumn Day</H2></A><P>Jump to the second section <A HREF="nowhere.htm#section2">
The file links.htm shows this example in action in a separate window.
A Cold Autumn Day</A> in the mystery "A man from Nowhere."
A as link
A hypertext link is a piece of content that the user can click to invoke an action. The most common actions are scrolling to a different place in the current document and opening a new document. A hypertext link can contain text and/or graphics.
To define a hypertext link, use the <A> tag with an HREF attribute to indicate the start of the hypertext link, and use the </A> tag to indicate the end of the link. When the user clicks any content between the <A HREF> and </A> tags, the link is activated.
The value of the HREF attribute must be a URL. If you want the link to open a new document, the value of HREF should be the URL for the destination document. If you want to scroll the current document to a particular place, the value of HREF should be the name of the anchor to which to scroll, preceded by the # sign. If you want to open another document at an anchor, give the URL for the document, followed by #, followed by the name of the anchor.
If you want the destination document or anchor to open in a separate browser window, supply the name of the window as the value of the TARGET attribute. If the named window does not already exist, a new window opens.
The link can also do actions other than opening and scrolling documents. It can send mail messages, point to files located on FTP servers, run any arbitrary JavaScript code, open local files, point to a gopher server, or read news groups. To do any of these actions, you specify an appropriate kind of URL, such as a mailto URL to send a mail message or a news URL to read a news group. See URLS for a discussion of the different kinds of URLs.
Most browsers display hypertext links in a color different from that of the rest of the document so that users can easily identify them. By default, Netscape Navigator displays links in blue, and displays visited links (that is, links that have been clicked) in purple. However, you can specify the default link colors for your document by specifying values for the LINK, VLINK, and ALINK attributes of the BODY tag, as discussed in the section BODY.
You can also define actions that occur when the mouse cursor enters or leaves the region containing the link by specifing onMouseOver and onMouseOut event handlers for the link. Additionally, you can specify an onClick event handler that determines the action to occur when the user clicks a link.
A link that has not been clicked is called an unvisited link. A link that has been clicked is known as a visited or followed link. A link that is in the process of being clicked is an active link.
HREF="location"
Syntax
<A
HREF="location
"
ONCLICK="clickJScode
"
ONMOUSEOUT="outJScode
"
ONMOUSEOVER="overJScode
"
TARGET="windowName
"
>
...
</A>
specifies a destination URL for the link. The most common value here is a document name or an anchor. To specify a document to open, provide the URL for the document, either as an absolute or relative URL.An example of an absolute URL is:
HREF="http://home.netscape.com/index.html"An example of a relative URL is:
HREF="documents/nextdoc.html"To scroll the current document to an anchor, give the name of the anchor preceded by the pound (#) sign. For example:
HREF="#anchor1"To open a different document at an anchor, give the URL for the document, followed by the # sign followed by the name of the anchor. For example:
HREF="documents/nextdoc.html"The HREF attribute can also be a URL that sends a message, points to files located on an FTP server, runs arbitrary JavaScript code, opens local files, points to a gopher server, or reads news groups. See URLS for a discussion of the different kinds of URLs.
ONCLICK="clickJScode"
specifies JavaScript code to execute when a user clicks the link. If you supply a value for the ONCLICK attribute, the specified action overrides the default link behavior.For information about JavaScript, see the JavaScript Guide or the JavaScript Reference.
ONMOUSEOUT="outJScode"
specifies JavaScript code to execute when a user moves the mouse cursor out of the link or anchor.
ONMOUSEOVER="overJScode"
specifies JavaScript code to execute when a user moves the mouse pointer over the image or link text. .
TARGET="windowName"
specifies a window in which to show the destination document (if the link's action is to scroll or open a document). If the named window is not already open, a new window with that name opens. Navigator 2.0
- _blank opens the destination document in a new unnamed window.
- _parent opens the destination document in the parent window of the one displaying the current document.
- _self opens the destination document in the same window as the one in which the link was clicked.
- _top opens the destination document in the full body of the current window. This value can be used to ensure that the destination document takes over the full window even if the original document was displayed in a frame.
P>You can find all the latest news from Netscape at
<A HREF="http://home.netscape.com/index.html">Netscape's Home Page</A>.
The file links.htm shows this example in action in a separate window. This file also illustrates many additional different uses of links.
Last Updated: 01/26/98 21:33:44