Latest web development tutorials

HTML DOM getElementsByName () method

Document Object Reference Document Object

Definition and Usage

getElementsByName () method returns an object with the specified name in the collection.

grammar

document.getElementsByName(name)

参数 描述
name 必须。元素的名称。


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support getElementsByName () method


Examples

Examples

Specifies the number of elements in the pop-up name:

<script>

var x=document.getElementsByName("x");
alert(x.length);

</script>

try it"


Document Object Reference Document Object