这是MSDN的解释: Elements that support both the NAME and the ID attribute are included in the collection returned by the getElementsByName method, but not elements with a NAME expando. 就是说,对于IE来说,id和name是通用的,这样就可以通过设置多个div的id相同,通过getElementsByName方法获取一组div对象(我只测试了IE6). 对于firefox和chrome(同safari)来说是有name属性的,即通过设置name即可实现(测试了chrome3.0.195.25,firefox3.0.11). 例子