ASP.NET Image AlternateTextProperty


Image 控件Image Control

Definition and Usage

The AlternateText property is used to set or return the alternate text for an image.

This property specifies the text to display if the image is unavailable.

In browsers that support it (Internet Explorer), the alternate text is displayed as a tooltip.

Syntax

<asp:Image AlternateText="text" runat="server" />
 
Property Description
text Specifies alternate text for the image.


Example

The following example sets the AlternateText property for the Image control (the image file does not exist):

<form runat="server">
<asp:Image id="Img1" ImageUrl="missing_img.gif"
runat="server" AlternateText="Image Text" />
</form>

Show Example »

Image 控件Image Control Other Extensions