如何设置使用javascript的文本框的值上的ASP.NET Web窗体 [英] How to set the value of a text box with javascript on an ASP.NET webform
本文介绍了如何设置使用javascript的文本框的值上的ASP.NET Web窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这样的形式我有以下控件:
so in a form I have the following control:
<asp:TextBox runat="server" ID="monthlyAmount" ClientIDMode="Static"/>
在静态的ClientIDMode是因为母版页中使用。
The ClientIDMode Static is because a master page is in use.
然后我有这个按钮:
<input type="button" id="calculate" onclick="AutoFillEstimate()" value="Calculate Estimate" />
有线这个脚本:
<script type="text/javascript">
function AutoFillEstimate() {
document.getElementById("monthlyAmount").nodeValue = "test";
}
</script>
我觉得我只是用什么,而不是我应该使用的nodeValue,但我不知道在哪里找这些东西的参考。
I feel like I'm just using nodeValue instead of what I should be using, but I have no idea where to look for reference on these things.
推荐答案
如果我理解正确,你只是想设置的值,只需使用:
If I understand you correctly, you are just trying to set the value, just use:
document.getElementById("monthlyAmount").value = "test";
这篇关于如何设置使用javascript的文本框的值上的ASP.NET Web窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文