Home >Web Front-end >JS Tutorial >Solution to why getElementsByName() in IE is invalid for some elements_javascript skills
Nothing else, such as div, span, etc.
Alternative:
Prerequisite: It is assumed that the TagNames of the obtained node arrays are consistent. (It is generally rare that the nodes in the obtained node array come from different tags)
JSP code snippet:
...... <logic:iterate id='t' name='dataList' > <tr class='list'> ...... <td class='normal'><span name='tbc'>${t.LOWAREATS_TBC }</span></td> ...... </tr> </logic:iterate> ......
javascript code snippet:
...... var tbcList = document.getElementsByTagName('span'); for(var i = 0; i < tbcList.length ; i++) { if(tbcList[i].name != 'tbc' ) continue; //......逻辑代码 } ......