English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
name属性指定 <input>元素的名称,name属性用于引用JavaScript中的元素,或在提交表单后引用表单数据。
具有三个输入字段的HTML表单;两个文本字段和一个提交按钮:
!DOCTYPE html> <html> <head> <title>HTML:<input> name 属性 - 基础教程网(oldtoolbag.com)</title> <body> <form action="action_page.php"> Name: <input type="text" name="fullname"><br> Email: <input type="text" name="email"><br> <input type="submit" value="Submit"> </form> </html>Test and see ‹/›
IEFirefoxOperaChromeSafari
All major browsers support the name attribute.
The name attribute specifies the name of the <input> element.
The name attribute is used to reference elements in JavaScript or to reference form data after the form is submitted.
Note: Only form elements with the name attribute will pass their values when the form is submitted.
None.
<input name="text">
Value | Description |
---|---|
text | Specify the name of the <input> element. |