w3pop.com :: ÍøÂçѧԺ :: ASP.NET :: ASP.NET - TextBox(Îı¾¿ò)¿Ø¼þ
The TextBox control is used to create a text box where the user can input text.
Îı¾¿ò¿Ø¼þ¿ÉÓÃÀ´´´½¨Óû§ÊäÈëÎÄ×ÖÓõÄÎı¾¿ò¡£
The TextBox control's attributes and properties are listed in our web controls reference page.
ÔÚÎÒÃǵÄWEB¿Ø¼þ²Î¿¼Ò³ÖÐÂÞÁÐÁËÎı¾¿ò¿Ø¼þµÄËùÓÐÊôÐÔ¡£
The example below demonstrates some of the attributes you may use with the TextBox control:
ÏÂÃæËùÒªÑÝʾµÄÊÇÄãÔÚʹÓÃÎı¾¿ò¿Ø¼þʱ¿ÉÄÜ»áÓõ½µÄһЩÊôÐÔ£º
<html> |
The contents and settings of a TextBox control may be changed by server scripts when a form is submitted. A form can be submitted by clicking on a button or when a user changes the value in the TextBox control.
µ±±íµ¥±»Ìύʱ¿Éͨ¹ý·þÎñÀ´µ÷ÕûÎı¾¿òµÄÄÚÈݺÍÉ趨¡£Ò»ÕÅ±íµ¥¿Éͨ¹ýµã»÷°´Å¥»òÊǵ±Óû§¸Ä±äÎı¾¿òµÄÄÚÈÝʱ½øÐÐÌá½»¡£
In the following example we declare one TextBox control, one Button control, and one Label control in an .aspx file. When the submit button is triggered, the submit subroutine is executed. The submit subroutine writes a text to the Label control:
ÔÚÏÂÃæµÄ¾ÙÀýÖÐÎÒÃÇÔÚÒ»¸ö.aspxÎļþÖÐÉùÃ÷ÁËÒ»¸öÎı¾¿ò¿Ø¼þ£¬º¬ÓÐÒ»¸ö°´Å¥¿Ø¼þ£¬Ò»¸ö±êÇ©¿Ø¼þ¡£µ±´¥·¢ÁËÌá½»°´Å¥£¬Ìá½»µÄ×Ó³ÌÐò¸øÓèÖ´ÐС£Ìá½»µÄ×Ó³ÌÐò»áÔÚ±êÇ©¿Ø¼þÀïдÉÏһЩÎÄ×Ö£º
<script runat="server"> <html> <form runat="server"> </body> |
In the following example we declare one TextBox control and one Label control in an .aspx file. When you change the value in the TextBox and either click outside the TextBox or press the Tab key, the change subroutine is executed. The submit change subroutine writes a text to the Label control:
ÔÚÏÂÃæµÄ¾ÙÀýÖÐÎÒÃǽ«ÔÚÒ»¸ö.aspxÎļþÖÐÉùÃ÷Ò»¸öÎı¾¿ò¿Ø¼þÒÔ¼°Ò»¸ö±êÇ©¿Ø¼þ¡£µ±Äã¸Ä±äÁËÎı¾¿òµÄÄÚÈݲ¢½«½¹µãÒÆÀëÎı¾¿ò(Êó±êµãÎı¾¿òµÄÍâÃæ»òÊǰ´ÁËTab¼ü)£¬change ×Ó³ÌÐò½«¸øÓèÖ´ÐС£change×Ó³ÌÐò»áÔÚ±êÇ©¿Ø¼þÉÏдÉÏһЩÎÄ×Ö£º
<script runat="server"> <html> <form runat="server"> </body> |
ÆÀÂÛ (0)
All