Why does the check box keep the JS write value while the text box cannot?
< Script >
Function Sel ()
{
Alert (form1.checkbox2. Checked );
Document. getelementbyid ( " Checkbox1 " ). Checked = Form1.checkbox2. checked;
Form1.textbox4. Value = " Test " ;
}
</ Script >
< ASP: checkbox ID = "Checkbox1" Runat = "Server" > </ ASP: checkbox >
< ASP: checkbox ID = "Checkbox2" Runat = "Server" Onclick = "Sel ()" > </ ASP: checkbox >
< ASP: textbox ID = "Textbox4" Runat = "Server" > </ ASP: textbox >
< ASP: button ID = "Button5" Runat = "Server" Text = "Button" > </ ASP: button >
Private void button5_click (Object sender, system. eventargs E)
{
Response. Write (checkbox1.checked. tostring () + "<br> ");
Response. Write (textbox4.text );
}
When checkbox2 is selected, checkbox1 is also selected, and,ProgramOutput True.
While textbox4 did not output the value test after hitting button5. Or empty.
It must be obtained through request.
Why?