也许是我大惊小怪,我现在才发现 hyperlink的target属性可以这么用

大家可以看一下asp.net Possible Values
sTarget String that specifies or receives 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 of _self.

看看我上面标注为红色部分就知道是为什么了。asp.net的文章列表中的hyperlink设置了这样的属性 target="_new"。

试试下面的代码,我也作出了同样的效果
AspnetUpload.net
Upload4Asp.net

不过有一点不好,就是我打开新页面之后,再次返回主页面点击其它链接,虽然新的链接已经加载,但是并不自动获得焦点而是停留在主页面。想了个办法解决,就是在打开的新页面中加一点javascript代码:

Hyperlink的target属性原来可以这么用 --zt     <script language=javascript>
Hyperlink的target属性原来可以这么用 --zt     

Hyperlink的target属性原来可以这么用 --zt
     script>
获取或设置单击 HyperLink 控件时链接到的 URL。

命名空间:System.Web.UI.WebControls

程序集:System.Web(在 system.web.dll 中)

属性值
单击 HyperLink 控件时链接到的 URL。默认值为空字符串 ("")。

示例

<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
<head>

</head>
<body>

   <h3>HyperLink Example</h3>

   Click on the HyperLink:<br> 

   <asp:HyperLink />      

</body>
</html>

版本信息

.NET Framework
受以下版本支持:2.0、1.1、1.0

相关文章:

  • 2021-06-01
  • 2021-10-16
  • 2022-12-23
  • 2022-02-01
  • 2021-12-04
  • 2021-06-23
  • 2022-12-23
  • 2021-11-07
猜你喜欢
  • 2021-12-17
  • 2022-12-23
  • 2021-11-22
  • 2022-01-02
  • 2022-12-23
  • 2021-09-18
  • 2021-07-11
相关资源
相似解决方案