Output name attribute

Definition and usage

name Attribute set or return <output> element of Name attribute Value.

The name attribute is used to identify form data after the form data is submitted to the server, or to reference form data on the client using JavaScript.

See also:

HTML Reference Manual:HTML <output> name 属性

HTML Reference Manual:HTML <output> 标签

Example

Example 1

Get the name of the <output> element:

var x = document.getElementById("myOutput").name;

Try it yourself

Example 2

Change the name of the <output> element:

document.getElementById("myOutput").name = "newOutputName";

Try it yourself

Syntax

Return name attribute:

outputObject.name

Set name attribute:

outputObject.name = name

属性值

描述
name 规定 <output> 元素的名称。

技术细节

返回值: 字符串值,表示 <output> 元素的名称。

浏览器支持

表中的数字注明了首个完全支持该属性的浏览器版本。

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
10.0 不支持 4.0 5.1 11.0