English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML 参考手册

HTML 标签大全

HTML: <input> multiple 属性

multiple 属性是布尔属性,它指定允许用户在 <input>元素中输入多个值,multiple 属性适用的input类型:email和 file。

 HTML <input> Tag

在线示例

文件上传字段,接受多个值:

<!DOCTYPE html>
<html>
<head>
<title>HTML:<input> multiple 属性 - 基础教程网(oldtoolbag.com)</title>
<body>
<form action="action_page.php">
  选择图片: <input type="file" name="img" multiple>
  <input type="submit">
</form>
在浏览本地文件时,可以尝试选择多个文件。</p>
</html>
测试看看 ‹/›

浏览器兼容性

IEFirefoxOperaChromeSafari

Internet Explorer 10、Firefox、Opera、Chrome 和 Safari 支持 multiple 属性。

注意:Internet Explorer 9 之前的版本不支持 <input> 标签的 multiple 属性。

Definition and Usage

The multiple attribute is a boolean attribute.

If present, it specifies that the user can enter multiple values in the<input>element.

Note: The multiple attribute applies to the input types: email and file.

Hint: For<input type ="file">: To select multiple files, hold down the CTRL or SHIFT key while selecting.

Hint: For<input type ="email">: Separate each email address in the email field with a comma, for example: [email protected], [email protected], [email protected].

HTML 4.01 with HTML5differences

The multiple attribute is an HTML5 with the new attributes.

Differences between HTML and XHTML

In XHTML, attribute abbreviations are prohibited, the multiple attribute must be defined as <input multiple="multiple" />。

Syntax

<input multiple>
 HTML <input> Tag