html中表单元素_HTML中的表单元素

html中表单元素

1)<input>元素 (1) The <input> Element)

The <input> element is used to get input from the user in an HTML form.

<input>元素用于以HTML形式从用户获取输入。

<input> tag is used to get input using input element, the type attribute of the input element is used to define inputs of multiple types in HTML.

<input>标记用于使用input元素获取输入,input元素的type属性用于定义HTML中多种类型的输入。

Syntax:

句法:

<input name="email" type="text" />

For the input element there are more values which will be discussed later.

对于输入元素,还有更多值,将在后面讨论。

2)<select>元素 (2) The <select> Element)

The select element is used to define the drop-down list (select Box) in the HTML form.

select元素用于定义HTML表单中的下拉列表(选择框)。

The <select> tag is used to define the list. Also, two more tags are required with the <select> tag for the work. They are <value> and <selected>.

<select>标记用于定义列表。 此外,还需要两个标签以及<select>标记才能进行工作。 它们是<value>和<selected> 。

The <value> tag defines an option that can be selected in the drop-down list.

<value>标记定义了一个可以在下拉列表中选择的选项。

The <selected> tag is used to define the element which is preselected in the form. By default, if no option is marked selected the first element is selected.

<selected>标签用于定义在表单中预先选择的元素。 默认情况下,如果未标记任何选项,则选择第一个元素。

Syntax:

句法:

<select name="bikes">
    <option value="value" selected> text </option>
    . . .
</select>

In select tags, you can also select the number of options that are visible directly to the user without clicking on dropdown.

在选择标签中,您还可以选择直接对用户可见的选项数量,而无需单击下拉菜单。

This is done by using the size attribute.

这是通过使用size属性来完成的。

Syntax:

句法:

<select name="name" size="3"> ... </select>

This will show 3 options directly.

这将直接显示3个选项。

In the select box, the user is allowed to select more that one (multiple) options. This is done by adding multiple attributes.

在选择框中,允许用户选择一个以上(多个)选项。 这可以通过添加多个属性来完成。

Syntax:

句法:

<select multiple> ... </select>

3)<textarea>元素 (3) The <textarea> Element)

The <textarea> element is used to define the text area input i.e. a multi-line input field in the HTML form.

<textarea>元素用于定义文本区域输入,即HTML表单中的多行输入字段。

This element needs the rows and cols attribute to be defined to set the number of rows and columns the <textarea> will occupy.

该元素需要定义rows和cols属性,以设置<textarea>将占用的行数和列数。

Syntax:

句法:

<textarea rows="5" cols="10"> text_to_displayed </textarea>

The dimensions of the <textarea> can also be defined using stylesheet in HTML.

<textarea>的尺寸也可以使用HTML中的样式表定义。

Syntax:

句法:

<textarea style="width:100px; height: 250px;"> text_to_displayed </textarea>

4)<Button>元素 (4) The <Button> Element)

The <button> element is HTML form is used to add a button to the form that can be clicked to perform actions in the form.

<button>元素是HTML表单,用于向表单添加按钮,可以单击该按钮以执行表单中的操作。

Syntax:

句法:

<button type="button" onclick="action_performed"> text </button>

5)<datalist>元素 (5) The <datalist> Element)

The <datalist> element in HTML form is used to define a list of data elements that are predefined for the input element. It will create a drop-down of all the input options available.

HTML形式的<datalist>元素用于定义为输入元素预定义的数据元素列表。 它将创建所有可用输入选项的下拉列表。

To connect the <input> element to the <datalist>, the id of the datalist is to be referred by the list attribute of the input tag.

要将<input>元素连接到<datalist> ,该数据列表的id将由输入标签的list属性引用。

Syntax:

句法:

<input list="datalist_id"/>
<datalist="datalist_id">
    <option>... </option>
    <option>... </option>
    <option>... </option>
</datalist>

6)<output>元素 (6) The <output> Element)

The <output> element in HTML form is used to return the result of some calculations that are done in realtime in the form.

HTML表单中的<output>元素用于返回以该表单实时完成的一些计算的结果。

<output> tag is used to define the output. Also, one on the input tag is used to define the operation.

<output>标记用于定义输出。 另外,输入标签上的一个用于定义操作。

Syntax:

句法:

<oninput="output_name.value= parseInt(input1.value) * parseInt(input2.value) "> 0
    <input name="input1">
    <input name="input2">
    <output name="output_name" for="input1 input2"></output>

翻译自: https://www.includehelp.com/html/form-elements.aspx

html中表单元素

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值