现在的位置: 首页 > 综合 > 正文

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

2013年09月07日 ⁄ 综合 ⁄ 共 393字 ⁄ 字号 评论关闭
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等

抱歉!评论已关闭.