HTML HTMLCollection对象访问的三种方式
例:
<form action="" name="lee"> <input type="text"></form>通过getElementsByTagName:
var form = document.getElementsByTagName('form')[0]console.log(form)通过item(n):
var form = document.forms.item(0)console.log(form)通过namedItem(name):
var form = document.forms.namedItem('lee')console.log(form)输出:
<form action="" name="lee"><input type="text"></form>适用对象:
1、document.all2、document.anchors3、document.forms4、document.images5、document.links
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。


