getElementsByName兼容ie 但并不是兼容ie下的所有标签

getElementsByName兼容ie 但并不是兼容ie下的所有标签

document.getElementsByName('someName') 返回一个节点列表(数组)
document.getElementById('id') 返回一个节点或者null


注意在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,p

也就是说IE下   ByName只检查 input及一部分控件