这是我的javascript获得另外2个文本框2个值的进入第三....JavaScript来在asp.net文本框添加2号,不工作
其不工作...
<script type="text/javascript">
function calculate(ctrl1, ctrl2, ctrl3) {
var c1 = document.getElementById(ctrl1);
var c2 = document.getElementById(ctrl2);
var c3 = document.getElementById(ctrl3);
if (c1 != null && c2 != null & c3 != null) {
c3.value = Number(c1.value) + Number(c2.value);
}
document.forms[0].txteanum.focus();
}
</script>
在文本框中
<asp:TextBox ID="txtQuantity" runat="server" onblur='javascript:calculate("txtQuantity","txtRate","TxtAmount")'></asp:TextBox>
检查我的答案在这里https://stackoverflow.com/a/11624756/1445836
是资本的 “T” 的Java脚本'一错字? (其他字段中的小写字母“t”。)如果浏览器中的查看源代码是那些实际从ASP代码生成的ID? – nnnnnn 2012-07-23 12:21:07
什么是txteanum? – codingbiz 2012-07-23 12:24:58
你能写一个else部分,并把一个alert/console.log来查找这些文本框中的任何一个是否为空? – naveen 2012-07-23 12:26:19