Partager via


HtmlImage.Alt Propriété

Définition

Obtient ou définit l’autre légende que le navigateur affiche si une image n’est pas disponible ou télécharge actuellement et n’est pas encore terminée.

public:
 property System::String ^ Alt { System::String ^ get(); void set(System::String ^ value); };
public string Alt { get; set; }
member this.Alt : string with get, set
Public Property Alt As String

Valeur de propriété

Chaîne qui contient l’autre légende du navigateur à utiliser lorsque l’image n’est pas disponible.

Exemples

L’exemple de code suivant montre comment utiliser la Alt propriété pour spécifier la légende à afficher lorsque l’image spécifiée par la Src propriété n’est pas disponible.

<%@ Page Language="C#" AutoEventWireup="True" %>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
 <head>
    <title>HtmlImage Example</title>
</head>
 
 <body>
 
    <form id="form1" runat="server">
 
       <h3>HtmlImage Example</h3>
     
       <img id ="Image1"
            src="Image1.jpg"
            alt="Image 1"
            runat="server"
            style="width:500; height:226; border:5; text-align:center" />
    
    </form>
 
 </body>
 </html>
<%@ Page Language="VB" AutoEventWireup="True" %>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
 <head>
    <title>HtmlImage Example</title>
</head>
 
 <body>
 
    <form id="form1" runat="server">
 
       <h3>HtmlImage Example</h3>
     
       <img id ="Image1"
            src="Image1.jpg"
            alt="Image 1"
            runat="server"
            style="width:500; height:226; border:5; text-align:center" />
    
    </form>
 
 </body>
 </html>

Remarques

Utilisez cette propriété pour spécifier la légende affichée lorsque l’image spécifiée par la Src propriété n’est pas disponible. Sur les navigateurs plus récents, cette légende apparaît également sous la forme d’une info-bulle.

S’applique à

Voir aussi