<A> the target of a tag clearly indicates where to open the target document.
First case: default case: When the value of the target property of the hyperlink is not set, the default value is _ self, that is, <a target = "_ Self">. It displays the target document inHyperlinkBoxRack or window. The following two lines of code have the same effect.
<A href = "http://www.baidu.com"> Baidu </a> <a href = "http://www.baidu.com" target = "_ Self"> Baidu </a>
Case 2: Give a bunch of hyperlinks the same target value. In this way, a group of hyperlinks can be opened in the same window, that isYou can click different links in a window to control content changes in another window.. First, the browser will find the document in the framework or window that matches the target value. If yes, the document will be displayed. If it does not exist, the browser opens a new window and identifies it as the target value. After that, as long as the window is not closed, other Hyperlinks can point to the new window.
<Ul> <li> <a href = "http://www.google.com.hk" target = "helloworld"> Google </a> </LI> <li> <a href = "http://cn.bing.com" target = "helloworld"> Bing </LI> <li> <a href = "http://www.baidu.com" target = "helloworld"> Baidu </a> </LI> <li> <a href = "http://www.soso.com" target = "helloworld"> Search </a> </LI> </ul>
Case 3: it is used in the Framework. Now there are 3 pages, one is father.html, one is son1.html, and the other is son2.html. The father page carries son1 and son2, and selects different links in son1 to dynamically change in son2. // Lxy: frameset and frame have been discarded in HTML5]
Father.html code:
<frameset cols="30%,*"> <frame src="son1.html"> <frame src="son2.html" name="son2"> </frameset>
Son1.html code:
<Body>
Son2.html code:
<body>
Effect:
Case 4: special values of target: _ blank, _ Self, _ parent, _ top, _ new. To understand the differences between these values, let's take a look at IFRAME. It mainly refers to the difference between the target value _ parent and _ top.
First, there are four pages: father.html, big.html, middle.html, and small.html.
Father.html carries the big.html Code as follows:
<body>father<br/><iframe src="big.html" width="800px" height="800px"></iframe></body>
Big.html carries middle.html. The Code is as follows:
<body bgcolor="darkgrey">iframe big<br/><iframe src="middle.html" width="600px" height="600px"></iframe></body>
Middle.html carries the small.html Code as follows:
<body bgcolor="darkcyan">iframe middle<br/><iframe src="small.html" width="400px" height="400px" ></iframe></body>
Small.html has a hyperlink. The Code is as follows. Let's take a look at the effect of the hyperlink with different target values:
<Body bgcolor = "# b8860b"> IFRAME small <br/> <a href = "http://www.baidu.com"> Baidu </a> </body>
The original effect is as follows:
Set the target value to _ Self (also the default value). The effect is as follows: Open the page in the window where the hyperlink is located.
Set the target value to _ parent as follows: it is opened in the parent window. If it is a top-level window, the _ parent effect is the same as that of _ self.
Set the target value to _ top as follows: it is opened in the top-level window.
Therefore, when using the multi-layer framework, you need to pay attention to the selection of the target value during hyperlink jump.
Fifth, the difference between the target attribute value _ new and _ blank:
_ NewAlways open in the same new window;
_ Blank is to open a new window once.
Target attribute of Hyperlink