var ElementLen = document.getElementsByName("xid") 这种写法不管一个还是多个,都正常
多谢2位老兄,,明白了。。只怪偶学习时没认真,没用心。-------------- getElementById Returns a reference to the first object with the specified value of the ID attribute. getElementsByName Retrieves a collection of objects based on the value of the NAME attribute. getElementsByTagName Retrieves a collection of objects based on the specified element name.
写成
document.getElementsByName("xid").length
这种写法不管一个还是多个,都正常
getElementById Returns a reference to the first object with the specified value of the ID attribute.
getElementsByName Retrieves a collection of objects based on the value of the NAME attribute.
getElementsByTagName Retrieves a collection of objects based on the specified element name.