Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/421.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 HTML表格:从一列(每行)和第二列中添加值,并在第三列中显示_Javascript_Php_Jquery - Fatal编程技术网

Javascript HTML表格:从一列(每行)和第二列中添加值,并在第三列中显示

Javascript HTML表格:从一列(每行)和第二列中添加值,并在第三列中显示,javascript,php,jquery,Javascript,Php,Jquery,(表将从数据库中提取,因此它将有N行) 我可以在控制台上使用'td:nth child(7)'获得结果,但我希望更改'td:nth child(5)'或'td:nth child(6)' 这里我得到了控制台值,但无法在列文本中得到它 $(“.btn”)。单击(函数(){ var$row=$(this.parents('tr'); var text0=$row.find('td:nth child(5)').text(); var text1=$row.find('td:nth child(6

(表将从数据库中提取,因此它将有N行)

我可以在控制台上使用'td:nth child(7)'获得结果,但我希望更改'td:nth child(5)'或'td:nth child(6)'

这里我得到了控制台值,但无法在列文本中得到它

$(“.btn”)。单击(函数(){
var$row=$(this.parents('tr');
var text0=$row.find('td:nth child(5)').text();
var text1=$row.find('td:nth child(6)').text();
var str=$row.find('td:nth child(7)').text();
var res=+text0++text1;
控制台日志(res);
});

Sr
产品名称
变体
属性
价格
数量
结果
1.
产品1
部门1
彩色的
4.
720
添加事务
2.
产品2
部门2
色绿色
6.
900
添加事务
你是说

函数显示(){
var$row=$(this.parents('tr');
var text0=$row.find('td:nth child(5)').text();
var text1=$row.find('td:nth child(6)').text();
var str=$row.find('td:nth child(7)').text();
var res=+text0++text1;
控制台日志(res);
}
美元(“.btn”)。在(“单击”,显示);
$(“[contenteditable]”。打开(“输入”,显示)

Sr
产品名称
变体
属性
价格
数量
结果
1.
产品1
部门1
彩色的
4.
720
添加事务
2.
产品2
部门2
色绿色
6.
900
添加事务

向我们展示代码,我们都理解代码,有时我们不理解您使用PHP执行查询的过程?不完全是,我只想在结果上显示(价格和数量)的加法结果-结果在哪里