GridView 中input的值怎么获取
前台代码:
<a href="#" onclick="jian(this);return false;">-</a><input type="text" id="txtProductNum" style="width:20px" value='<%#Eval("ProductNum")%>'
onchange="bian(this)" runat="server"/><a href="#" onclick="jia(this);return false;">+</a>
后台.cs代码需要怎么获取?
js 代码实现加减改变input里的数字;后台.cs代码需要怎么获取input里的值?
js代码如下:
function jia(ele) {
tr = ele.parentNode;
while (tr.nodeType != 1 || tr.tagName != "TR")
tr = tr.parentNode;
txtProductNum = tr.cells[2].getElementsByTagName("input")[0];
var t = parseInt(txtProductNum.value, 10);
if (isNaN(t)) txtProductNum.value = 0;
else txtProductNum.value = t + 1;
}
function jian(ele) {
tr = ele.parentNode;
while (tr.nodeType != 1 || tr.tagName != "TR") tr = tr.parentNode;
txtProductNum = tr.cells[2].getElementsByTagName("input")[0];
var t = parseInt(txtProductNum.value, 10);
if (isNaN(t)) txtProductNum.value = 0;
else {
if (t < 1) return;
txtProductNum.value = t - 1;
}
}
function bian(ele) {
tr = ele.parentNode;
while (tr.nodeType != 1 || tr.tagName != "TR") tr = tr.parentNode;
}
------解决方案--------------------在前台把inp