The code copy is as follows:
document.getElementsByName('someName') Returns a list of nodes (array)
Note: In IE, some nodes do not have the name attribute, which cannot be obtained using document.getElementsByName. Only the following tags have name attribute:
A, APPLET, attribute, BUTTON, EMBED, FORM, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, LINK, MAP, OBJECT, RT, RUBY, SELECT, TEXTAREA
Nothing else, such as div, span, etc.
Alternatives:
Prerequisite: Assume that the TagName of the retrieved node array is consistent. (It is generally rare to see the nodes in the acquired node array 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;//......Logistic code} ......