Export (0) Print
Expand All

HtmlAnchor.Target Property

Gets or sets the target window or frame to load Web page content into.

[Visual Basic]
Public Property Target As String
[C#]
public string Target {get; set;}
[C++]
public: __property String* get_Target();
public: __property void set_Target(String*);
[JScript]
public function get Target() : String;
public function set Target(String);

Property Value

The target window or frame to load Web page content into. Values must begin with a letter in the range of a-z, except for the following special values, which begin with an underscore:

_blank Renders the content in a new, unframed window.
_parent Renders the content in the immediate frameset parent.
_self Renders the content in the frame with focus.
_top Renders the content in the full, unframed window.

Remarks

Use this property to specify the frame or window that displays the Web page linked to.

CAUTION   In HTML 4.0, target attribute values are case-insensitive, so _top and _TOP have the same meaning. However, most browsers treat this value as case-sensitive and thus do not recognize _TOP as having the special meaning as described for _top.

Example

[Visual Basic, C#, JScript] The following example demonstrates how to use the Target property to display the page navigated to when the HtmlAnchor is clicked in a new, unframed window.

[Visual Basic] 
<%@ Page Language="VB" AutoEventWireup="True" %>
 <html>
   
    <body>
      <form method=post runat=server>
  
         <a HRef="http://www.microsoft.com"
            Target="_blank" 
            runat=server> Enter site.</a>
  
       </form>
     </body>
 
 </html>
    

[C#] 
<%@ Page Language="C#" AutoEventWireup="True" %>
 <html>
   
    <body>
      <form method=post runat=server>
  
         <a HRef="http://www.microsoft.com"
            Target="_blank" 
            runat=server> Enter site.</a>
  
       </form>
     </body>
 
 </html>
    

[JScript] 
<%@ Page Language="JScript" AutoEventWireup="True" %>
 <html>
   
    <body>
      <form method=post runat=server>
  
         <a HRef="http://www.microsoft.com"
            Target="_blank" 
            runat=server> Enter site.</a>
  
       </form>
     </body>
 
 </html>
    

[C++] No example is available for C++. To view a Visual Basic, C#, or JScript example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

HtmlAnchor Class | HtmlAnchor Members | System.Web.UI.HtmlControls Namespace

Show:
© 2014 Microsoft