成都网站建设设计

将想法与焦点和您一起共享

HTMLHTMLCollection对象访问的三种方式

例:
  1. 通过getElementsByTagName:
    var form = document.getElementsByTagName('form')[0]
    console.log(form)
  2. 通过item(n):
    var form = document.forms.item(0)
    console.log(form)
  3. 通过namedItem(name):
    var form = document.forms.namedItem('lee')
    console.log(form)
    输出:
    适用对象:
    1、document.all
    2、document.anchors
    3、document.forms
    4、document.images
    5、document.links

当前题目:HTMLHTMLCollection对象访问的三种方式
分享链接:http://chengdu.cdxwcx.cn/article/pchsoh.html