?
Dieses Dokument verwendet PHP-Handbuch für chinesische Websites Freigeben
ImageButton 控件用于顯示可點(diǎn)擊的圖像。
屬性 | 描述 | .NET |
---|---|---|
CausesValidation | 規(guī)定在 ImageButton 控件被點(diǎn)擊時(shí),是否驗(yàn)證頁面。 | 1.0 |
CommandArgument | 有關(guān)要執(zhí)行的命令的附加信息。 | 1.0 |
CommandName | 與 Command 事件相關(guān)的命令。 | 1.0 |
GenerateEmptyAlternateText | 規(guī)定該控件是否創(chuàng)建空字符串作為替代文本。 | 2.0 |
OnClientClick | 當(dāng)圖像被點(diǎn)擊時(shí)要執(zhí)行的函數(shù)的名稱。 | 2.0 |
PostBackUrl | 當(dāng) ImageButton 被點(diǎn)擊時(shí),從當(dāng)前頁面進(jìn)行回傳的目標(biāo)頁面的 URL。 | 2.0 |
runat | 規(guī)定該控件是一個(gè)服務(wù)器控件。必須被設(shè)置為 "server"。 | 1.0 |
TagKey | 1.0 | |
ValidationGroup | 當(dāng) ImageButton 回傳服務(wù)器時(shí),該 ImageButton 控件引起驗(yàn)證所針對(duì)的控件組。 | 2.0 |
注釋: Image 控件的屬性也能夠用在 ImageButton 控件上。
AccessKey,?Attributes,?BackColor,?BorderColor,?BorderStyle,?BorderWidth,?CssClass,?Enabled,?Font,?EnableTheming,?ForeColor,?Height,?IsEnabled,?SkinID,?Style,?TabIndex,?ToolTip,?Width
如需完整描述,請(qǐng)?jiān)L問 Web 控件標(biāo)準(zhǔn)屬性。
AppRelativeTemplateSourceDirectory,?BindingContainer,?ClientID,?Controls,?EnableTheming,?EnableViewState,?ID,?NamingContainer,?Page,?Parent,?Site,?TemplateControl,?TemplateSourceDirectory,?UniqueID,?Visible
如需完整描述,請(qǐng)?jiān)L問 控件標(biāo)準(zhǔn)屬性。
ImageButton
<script??runat="server"> Sub?getCoordinates(sender?As?Object,?e?As?ImageClickEventArgs)? ???mess.Text="Coordinates:?"?&?e.x?&?",?"?&?e.y End?Sub </script> <!DOCTYPE?html> <html> <body> <form?runat="server"> <p>Click?on?the?image:</p> <asp:ImageButton runat="server" ImageUrl="smiley.gif" OnClick="getCoordinates"/> <p><asp:label?id="mess"?runat="server"/></p> </form> </body> </html>
在本例中,我們?cè)?.aspx 文件中聲明了一個(gè) ImageButton 控件和一個(gè) Label 控件。在用戶點(diǎn)擊此圖像時(shí),會(huì)執(zhí)行 subroutine 子例程。這個(gè)子例程會(huì)把消息 "Coordinates: " 以及單擊的 x 和 y 坐標(biāo)發(fā)送到 Label 控件。