?
Ce document utilise Manuel du site Web PHP chinois Libérer
CheckBox 控件用于顯示復(fù)選框。
屬性 | 描述 | .NET |
---|---|---|
AutoPostBack | 規(guī)定在 Checked 屬性已改變后,是否立即向服務(wù)器回傳表單。默認(rèn)是 false。 | 1.0 |
CausesValidation | 規(guī)定點(diǎn)擊 Button 控件時(shí)是否執(zhí)行驗(yàn)證。 | 2.0 |
Checked | 規(guī)定是否已選中該復(fù)選框。 | 1.0 |
InputAttributes | 該 CheckBox 控件的 Input 元素所用的屬性名和值的集合。 | 2.0 |
LabelAttributes | 該 CheckBox 控件的 Label 元素所用的屬性名和值的集合。 | 2.0 |
runat | 規(guī)定該控件是服務(wù)器控件。必須被設(shè)置為 "server"。 | 1.0 |
Text | 與復(fù)選框關(guān)聯(lián)的文本標(biāo)簽。 | 1.0 |
TextAlign | 與復(fù)選框關(guān)聯(lián)的文本標(biāo)簽的對(duì)齊方式。(right 或 left) | 1.0 |
ValidationGroup | 在 CheckBox 控件回發(fā)到服務(wù)器時(shí)要進(jìn)行驗(yàn)證的控件組。 | 2.0 |
OnCheckedChanged | 當(dāng) Checked 屬性被改變時(shí),被執(zhí)行函數(shù)的名稱。 |
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)屬性。
Checkbox
<script??runat="server"> ???Sub?Check(sender?As?Object,?e?As?EventArgs)? ?????if?check1.Checked?then ???????work.Text=home.Text ?????else ???????work.Text="" ?????end?if ???End?Sub </script> <!DOCTYPE?html> <html> <body> <form?runat="server"> <p>Home?Phone: <asp:TextBox?id="home"?runat="server"?/> <br> Work?Phone: <asp:TextBox?id="work"?runat="server"?/> <asp:CheckBox?id="check1" Text="Same?as?home?phone"?TextAlign="Right" AutoPostBack="True"?OnCheckedChanged="Check" runat="server"?/> </p> </form> </body> </html>
在本例中,我們?cè)?.aspx 文件中聲明了兩個(gè) TextBox 控件和一個(gè) CheckBox 控件。然后,我們?yōu)?CheckedChanged 事件創(chuàng)建一個(gè)事件句柄,把包含 home phone 的文本框的內(nèi)容復(fù)制到包含 work phone 的文本框中。