获取Javascript,php中的文本框总和 [英] Get total sum of textbox in Javascript, php
本文介绍了获取Javascript,php中的文本框总和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我显示值的PHP代码。
< input type = text id = txtParticulars name = txtParticulars value = '。 $特殊。' > < 输入 类型 = text id = txtQty'。$ RSD_No。' value = '。$ Quantity。' readonly >
< 输入 type = text id = txtUP name = txtUP'。$ RSD_No。' / > < 输入 type = text id = txtTotal'。$ RSD_No。' readonly >
总计:< 输入 type = text id = txtGrandTotal class = < span class =code-keyword>添加 readonly / >
和javascript。
功能计算(行)
{
var in1 = document.getElementById('txtQty'+ row).value;
var in2 = document.getElementById('txtUP'+ row).value;
var in3 = in1 * in2;
var total = document.getElementById('txtTotal'+ row).value = in3.toFixed(2);
}
我有一个有价值的文本框,我需要的是得到总数。
解决方案
特殊。' > < 输入 类型 = text id = txtQty'。
RSD_No。 ' value < span class =code-keyword> = '。
Quantity。' readonly >
< 输入 类型 = text id = txtUP name = txtUP。
here is my php code to display the values.
<input type="text" id="txtParticulars" name="txtParticulars" value="'.$Particular.'"><input type="text" id="txtQty'.$RSD_No.'" value ="'.$Quantity.'" readonly>
<input type="text" id="txtUP" name="txtUP'.$RSD_No.'" /><input type="text" id="txtTotal'.$RSD_No.'" readonly>
Total:<input type="text" id="txtGrandTotal" class="add" readonly />
and the javascript.
function calc(row) { var in1=document.getElementById('txtQty'+row).value; var in2=document.getElementById('txtUP'+row).value; var in3=in1*in2; var total = document.getElementById('txtTotal'+row).value=in3.toFixed(2); }
I have textboxes that has a value, what I need is to get the grand total.
解决方案
Particular.'"><input type="text" id="txtQty'.
RSD_No.'" value ="'.
Quantity.'" readonly> <input type="text" id="txtUP" name="txtUP'.
这篇关于获取Javascript,php中的文本框总和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文