Front-endCode(Mainly textbox controls and CSS)
<! 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 runat = "server">
<Title> </title>
<Style>
Input
{
Border: 1px solid # e0e0e0;
Margin: 1px;
}
. Normaltxt
{
Border: 1px solid # e0e0e0;
}
. Specialtxt
{
Border: 1px solid # ff8000;
}
</Style>
</Head>
<Body>
<Form ID = "form1" runat = "server">
<Div>
<Asp: textbox id = "textbox1" runat = "server"> </ASP: textbox> <br/>
<Asp: textbox id = "textbox2" runat = "server"> </ASP: textbox> </div>
</Form>
</Body>
</Html>
Background code:
Protected void page_load (Object sender, eventargs E)
{
Int npagecontrols = Controls. count;
For (INT I = 0; I <npagecontrols; I ++) // Parent control layer
{
Foreach (control CTL in Page. controls [I]. Controls) // Child control layer
{
If (CTL Is textbox)
{
Textbox TB = (textbox) This. findcontrol (CTL. ID );
TB. attributes. Add ("Onfocus", "This. classname = 'specialtxt '"); // Add JavaScript event processing for the control
TB. attributes. Add ("Onblur", "This. classname = 'normaltxt '");
}
}
}
}