• 2016/01/19 javascript学习笔记-name属性


    1. name属性只在少数html元素中有效:包括表单、表单元素、<iframe>和<img>元素。

    基于name属性的值选取html元素,可以使用document对象的getElementByName()方法。

    var radioButtons = document.getElementByName("color");

    注:在IE中,getElementByName()也返回id属性匹配指定值的元素,为了兼容性,不要将同样的字符串同时用作id和name。

    2.getElementByName()和getElementByTagName()都返回NodeList对象,而类似document.images和document.forms的属性为HTMLCollection对象。

    这些对象都是只读的类数组对象。有length属性。也可索引(只读不写)。

  • 相关阅读:
    BZOJ 2002 [Hnoi2010]Bounce 弹飞绵羊 ——Link-Cut Tree
    BZOJ 2049 [Sdoi2008]Cave 洞穴勘测 ——Link-Cut Tree
    hdu
    hdu
    hdu
    hdu
    hdu
    hdu
    hdu
    hdu
  • 原文地址:https://www.cnblogs.com/viola-sh/p/5141310.html
Copyright © 2020-2023  润新知