Text field
The text field is for typing characters using the keyboard. There are three form elements that are used for this purpose: a one-line text field, a field for entering a password, and a multi-line text field.
Text field
Creates an entry for the user to enter a line of text.
Field parameters are listed in Table. 1.
Parameter | Description |
---|---|
Size | The width of the field. |
Maxlength | The maximum number of characters allowed in the text. If you omit this parameter, you can enter a string that is longer than the field itself. |
Name | The name of the field. It is intended for the form handler to be able to identify this field. |
Value | The initial text is in the field. |
Example 1 shows the creation of a text field with different parameters
Example 1. Text box
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text / html; charset = windows-1251">
<Title> Text field </ title>
</ Head>
<Body>
<Form action = "/ cgi-bin / handler.cgi">
<P> <b> What's your name? </ B> </ p>
<P> < input type = "text" maxlength = "25" size = "20"> </ p>
</ Form>
</ Body>
</ Html>
As a result, we get the following.
What is your name?
Password field
The password field is an ordinary text field, but differs in that all the characters are shown with asterisks. It is designed so that no one peeps at the input password.
The possible parameters coincide with the previous element and are listed in Table. 1. Example 2 shows the creation of a text field for entering a password.
Example 2. Password field
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text / html; charset = windows-1251">
<Title> Password field </ title>
</ Head>
<Body>
<Form action = "/ cgi-bin / handler.cgi">
<P> <b> Login: </ b> <input type = "text" maxlength = "25" size = "20" name = "text"> </ p>
<P> <b> Password: </ b> <input type = "password" maxlength = "15" size = "20" name = "pass"> </ p>
</ Form>
</ Body>
</ Html>
The result of this example is shown below.
Login:
Password:
Although the input text is not shown, the data of this field is transmitted to the server in an open form without encryption. Therefore, the use of this field does not ensure data security and can be intercepted.
Multiline text
The <TEXTAREA> field is used to create an area in which you can enter several lines of text.
text
</ Textarea>
Between the <textarea> and </ textarea> tags, you can put any text that will be displayed when the field is loaded.
Field parameters are listed in Table. 2.
Parameter | Description |
---|---|
Name | The name of the field. It is intended for the form handler to be able to identify this field. |
Cols | Number of columns of text. |
Rows | The number of lines of text. |
Wrap | String transfer options. Possible values are: Off - disables line wrapping; Virtuals - shows line breaks, but sends text as it is entered; Physical - line breaks are inserted where specified and in this form the text is sent. |
The use of various parameters is demonstrated in Example 3.
Example 3. Multiline text
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text / html; charset = windows-1251">
<Title> Multi-line text </ title>
</ Head>
<Body>
<Form action = "/ cgi-bin / handler.cgi">
<P> <b> Enter your feedback: </ b> </ p>
<P> <textarea rows = "10" cols = "45"> </ textarea> </ p>
</ Form>
</ Body>
</ Html>
As a result, we get the following.
Enter your feedback:
Copyright © www.htmlbook.ru
Comments
When commenting on, remember that the content and tone of your message can hurt the feelings of real people, show respect and tolerance to your interlocutors even if you do not share their opinion, your behavior in the conditions of freedom of expression and anonymity provided by the Internet, changes Not only virtual, but also the real world. All comments are hidden from the index, spam is controlled.