js使用for循环与innerHTML获取选中tr下td值
function getParentEl (el, tagName) { if (!el) return el; do { el = el.parentNode; } while(el && el.tagName !== tagName); return el; } function temp(){ //得到选中row的value值 var temp=document.getElementsByName('id'); for(var i=0;i<temp.length;i++){ if(temp[i].checked==true){ edit=temp[i].value; var tr = getParentEl(temp[i], 'TR'); var tds = tr.cells; for (var j = 0; j < tds.length; j++) { var tdInner = tds[j].innerHTML; alert(tdInner); } } } }
相关推荐
阿斌Elements 2020-06-11
zrtlin 2020-11-09
xuebingnan 2020-11-05
wikiwater 2020-10-27
heheeheh 2020-10-19
Crazyshark 2020-09-15
softwear 2020-08-21
ZGCdemo 2020-08-16
jczwilliam 2020-08-16
littleFatty 2020-08-16
idning 2020-08-03
jinxiutong 2020-07-26
lanzhusiyu 2020-07-19
Skyline 2020-07-04
xiaofanguan 2020-06-25
Aveiox 2020-06-23