Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/419.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用JavaScript遍历表以获取特定单元格的值_Javascript - Fatal编程技术网

使用JavaScript遍历表以获取特定单元格的值

使用JavaScript遍历表以获取特定单元格的值,javascript,Javascript,如何使用JavaScript遍历表以获取单元格4和5的值 这就是我所拥有的: function constructString() { var table=document.getElementById('wcList'); for(var i=0; i<table.rows.length;i++){ var row = getElem(RowId + i); var str_wc = table.rows[i]

如何使用JavaScript遍历表以获取单元格4和5的值

这就是我所拥有的:

function constructString() {    
    var table=document.getElementById('wcList');

    for(var i=0; i<table.rows.length;i++){

        var row       = getElem(RowId + i);
        var str_wc    = table.rows[i].cells[1].firstChild.value;
        var str_act   = table.rows[i].cells[5].firstChild.value;
        var str_coh   = table.rows[i].cells[6].firstChild.value;
        var str_mconf = table.rows[i].cells[7].firstChild.value;

        var string1 = str_wc + row + str_act + row + str_coh + row + str_mconf + row;

     }
}
函数constructString(){
var table=document.getElementById('wcList');
对于(var i=0;i使用

试试这个:

function constructString() {   
    var table=document.getElementById('wcList');

    for(var i=0; i<table.rows.length;i++){

        // FIX THIS
        var row = 0;

        var str_wc=(table.rows[i].cells[1].innerHTML);
        var str_act=(table.rows[i].cells[5].innerHTML);
        var str_coh=(table.rows[i].cells[6].innerHTML);
        var str_mconf=(table.rows[i].cells[7].innerHTML);

        var string1=str_wc +row+str_act+row+str_coh+row+str_mconf+row;

        alert(string1);
     }
}  
函数constructString(){
var table=document.getElementById('wcList');

对于(var i=0;i
getElem()
不是原生JS或DOM函数,它能做什么?一小段HTML代码也会很有帮助…在sap mii中工作,因此页面显示在xsl中。显示表允许用户选择一行或多行并更新第5、6、7列,然后单击“保存”按钮。需要循环所有编辑的行,并构建一个串联值字符串es。然后创建一个BLS(updateWCData),将上面创建的字符串作为输入。请向我们显示表格的一行,这样我们就不需要猜测您如何获得所需的内容。请帮助我们帮助您。。。