当前位置:网站首页>Educator web exercise - creating a text area

Educator web exercise - creating a text area

2022-06-21 12:33:00 It's a deer

Create a text area

The first 1 Turn off :textarea Control related concepts

Related knowledge

textarea Attributes of the tag

textarea Labels are used to define multiline text areas , The text area can hold an unlimited number of text , The default font for text is constant width font (Courier).

textarea Basic properties of

textarea The basic properties of are :

  • cols: Specify the number of characters in each line
  • rows: Specify the number of visible lines
  • name: Specifies the name of the text area
  • readonly: Specifies that the text area is read-only
  • disabled: Specifies that the text area is not available
HTML5 in textarea New properties of

textarea The new properties of the are :

  • wrap: Specify when the form is submitted , Text wrapping mode of text area . The value is soft No line break , The value is hard Means line break
  • maxlength: Specifies the maximum number of characters in the text area
  • placeholder: A brief reminder , Describe the expected input value in the text area
  • required: Specifying a text area is required / Required .
  • autofocus: Specifies that when the page loads , The text area automatically gets the focus
  • form: Define one or more forms to which the text area belongs .

Customs clearance knowledge

1、 If the text area is set to display 10 That's ok , Each line shows 50 Characters , The right choice is (C)
A、<textarea rows="50" cols="10"> 
B、<input rows="50" cols="10">
C、<textarea rows="10" cols="50">
D、<input rows="10" cols="50">

2、 If the text area is set to read-only , Can be found in textarea Add... To the tag (B) attribute .
A、disabled
B、readonly
C、required
D、autofocus

3、 Make... When the form is submitted textarea  Text wrapping in , The right choice is (D)
A、<textarea name="mm" rows="5" cols="50"> 
B、<textarea name="mm" rows="5" cols="50" wrap>
C、<textarea name="mm" rows="5" cols="50" wrap="soft">
D、<textarea name="mm" rows="5" cols="50" wrap="hard">

4、textarea The properties of the tag do not include (A)
A、width
B、rows
C、cols
D、maxlength

5、textarea The width of the text area is available size Property to set .(B)
A、 correct 
B、 error 

The first 2 Turn off : Create a text field

Related knowledge

Setting of text field

stay textarea In the label , Use cols Property to specify the number of characters per line in the text field , Use cols Property to specify the number of characters per line in the text field , Use rows Property to specify the number of lines visible in the text field , Use name Property specifies the name of the text field , Use wrap Property to specify when the form is submitted , Text wrapping mode of text area . add to required Property can specify that the contents of the text field must be filled in .

Examples are as follows :

Recommended reasons :<textarea name="userName" cols="40" rows="4" wrap="hard" required="required"></textarea>

The effect is as follows :

image-20211209002112219

Programming requirements

In the editor on the right Begin - End Supplement code in the area , The specific requirement is :

  1. Create a text field
  2. The name of the text field is “reason"
  3. The number of visible lines in the text field is 6, Each row 50 Characters
  4. The text field must be filled in
  5. When the form is submitted , The text in the text display area should wrap automatically at the end of the line

The effect is as follows :

 Text field rendering

Customs clearance code

<!DOCTYPE html>
<html>
  <head>
   <meta charset="utf-8"/>
   <title> Set text field </title>
  </head>
  <body>
   <form action="" method="post">
      Please enter your reason for choosing this major :<br/>
    <!-- ********* Begin ********* -->
     <textarea name="reason" cols="50" rows="6" required="required" wrap="hard"></textarea>
    <!-- ********* End ********* -->
     <br/>
     <input type="reset" value=" Reset ">
     <input type="submit" value=" Submit ">
  </body>
</html>
原网站

版权声明
本文为[It's a deer]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/172/202206211221485552.html