Copy codeThe Code is as follows:
<Body>
<Form id = "form1" runat = "server">
<Div>
Name: <asp: TextBox ID = "txtUser" runat = "server"> </asp: TextBox>
<Br/>
<Br/>
Gender: <asp: RadioButtonList ID = "rblsex" runat = "server">
<Asp: ListItem> male </asp: ListItem>
<Asp: ListItem> female </asp: ListItem>
</Asp: RadioButtonList>
Password: <asp: TextBox ID = "txtPwd" runat = "server" TextMode = "Password"> </asp: TextBox>
<Br/>
Mobile Phone: <asp: TextBox ID = "txttel" runat = "server"
Ontextchanged = "TextBox3_TextChanged"> </asp: TextBox>
<Br/>
Introduction: <br/>
<Asp: TextBox ID = "txtinfo" runat = "server"> </asp: TextBox>
<Br/>
<Br/>
<Asp: ImageButton ID = "ImageButton1" runat = "server" Height = "58px"
ImageUrl = "~ /Img/QQ20130909140346.png "Width =" 72px "/>
<Br/>
<Br/>
<Br/>
<Br/>
<Br/>
</Div>
</Form>
</Body>
The textChange Event code is as follows:
Copy codeThe Code is as follows:
Protected void txtNum2_TextChanged (object sender, EventArgs e)
{
If (txtNum2.Text. Length = 0)
{
// Page. RegisterClientScriptBlock ("", "<script> alert ('enter a number'); </script> ");
Page. ClientScript. RegisterClientScriptBlock (this. GetType (), "", "<script> alert ('enter a number'); </script> ");
TxtNum2.Focus ();
}
Else
{
Int result;
Bool n1 = Information. IsNumeric (txtNum2.Text. Trim ());
If (n1)
{
Result = int. Parse (txtNum2.Text. Trim () % 2;
If (result = 0)
{
TxtSum. Text = "even ";
}
Else
{
TxtSum. Text = "odd ";
}
}
}
}
}