//根据标签名选择元素 function getByName(Name){ var i = document.getElementsByName(Name); if(i>0){ return i; }else{ var aele = document.getElementsByTagName(‘*‘); var arr = []; for (var i = 0;i<aele.length;i++){ if(aele[i].getAttribute("name")==Name){ arr.push(aele[i]); } } return arr; }