/** * 修正IE下document.getElementsByName无法获取DIV标签 * */ function getElementsByName(tag, name){ var returns = document.getElementsByName(name); if (returns.length > 0) return returns; returns = new Array(); var e = document.getElementsByTagName(tag); alert(e.length); for (var i = 0; i < e.length; i++) { if (e[i].getAttribute("name") == name) { returns[returns.length] = e[i]; } } return returns; }
?