Maybe it's just a big fuss. Now I found that the target attribute of hyperlink can be used like this.
Let's take a look at Asp.net'sASP. NET articles -- Updated daily!Click the link to open an article in a new window.ArticleDo not close the new window and click the link of another article. You can find that the new link does not open a new window, but loads it in the previously opened window, in this way, we can avoid opening too many new windows.
Curious. Read it.Source code, Nothing special, but I checked msdn and found that the target attribute is explained as follows:
Possible values
Starget |
String That specifies or distinct es one of the following values.
Name |
The name of the target window or frame. |
_ Blank |
Load the linked document into a new blank window. This window is not named. |
_ Media |
Load the linked document into the HTML content area of the media bar. Available in Internet Explorer 6 or later. |
_ Parent |
Load the linked document into the immediate parent of the document the link is in. |
_ Search |
Load the linked document into the browser search pane. Available in Internet Explorer 5 or later. |
_ Self |
Default. Load the linked document into the window in which the link was clicked (the active window ). |
_ Top |
Load the linked document into the topmost window. |
|
The property is read/write. The property has a default value_ Self.
Let's see why I marked it in red. Hyperlink in Asp.net's article list sets this attribute target = "_ new ".
Try the followingCodeAnd I made the same effect.
Aspnetupload.net
Upload4asp.net
But it is a little bad. After I open a new page, I return to the home page and click another link. Although the new link has been loaded, it does not automatically get the focus, but stays on the home page. A solution is to add JavaScript code to the new page:
Script Language=Javascript>
Script>