当前位置: 代码迷 >> 综合 >> getElementsByName()对有些元素无效(例如span)
  详细解决方案

getElementsByName()对有些元素无效(例如span)

热度:7   发布时间:2024-01-09 23:57:26.0
document.getElementsByName('someName') 返回一个节点列表(数组)

注意:在IE下有些节点是没有name 属性的,就是用document.getElementsByName获取不到的。只有下面的tag有name属性:
    A, APPLET, attribute, BUTTON, EMBED, FORM, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, LINK, MAP, OBJECT, RT, RUBY, SELECT, TEXTAREA

    其他都没有,比如 div,span等
  相关解决方案