Javascript 动态设置输入框的值
我有一个带有输入文本框控件的aspx页面,我想为其设置一个值。我希望它能够在提交表单时根据文本框的当前文本动态更改值。有人知道在没有jquery的情况下如何做到这一点吗?我想这正是您想要的,但不确定: JavaScript:Javascript 动态设置输入框的值,javascript,asp.net,Javascript,Asp.net,我有一个带有输入文本框控件的aspx页面,我想为其设置一个值。我希望它能够在提交表单时根据文本框的当前文本动态更改值。有人知道在没有jquery的情况下如何做到这一点吗?我想这正是您想要的,但不确定: JavaScript: function ChangeValue(currentTxtBox, newValue) { var otherTxtbox = document.getElementById('<%=otherTxtbox.ClientID%>'); o
function ChangeValue(currentTxtBox, newValue)
{
var otherTxtbox = document.getElementById('<%=otherTxtbox.ClientID%>');
otherTxtbox.value = currentTxtBox.value;
}
<asp:textbox id="bla" runat="server" onchange="ChangeValue(this)" />
<asp:textbox id="otherTxtbox " runat="server" />
函数更改值(currentTxtBox,newValue)
{
var otherTxtbox=document.getElementById(“”);
otherTxtbox.value=当前txtbox.value;
}
标记:
function ChangeValue(currentTxtBox, newValue)
{
var otherTxtbox = document.getElementById('<%=otherTxtbox.ClientID%>');
otherTxtbox.value = currentTxtBox.value;
}
<asp:textbox id="bla" runat="server" onchange="ChangeValue(this)" />
<asp:textbox id="otherTxtbox " runat="server" />
我想这就是你想要的,但我不确定: JavaScript:
function ChangeValue(currentTxtBox, newValue)
{
var otherTxtbox = document.getElementById('<%=otherTxtbox.ClientID%>');
otherTxtbox.value = currentTxtBox.value;
}
<asp:textbox id="bla" runat="server" onchange="ChangeValue(this)" />
<asp:textbox id="otherTxtbox " runat="server" />
函数更改值(currentTxtBox,newValue)
{
var otherTxtbox=document.getElementById(“”);
otherTxtbox.value=当前txtbox.value;
}
标记:
function ChangeValue(currentTxtBox, newValue)
{
var otherTxtbox = document.getElementById('<%=otherTxtbox.ClientID%>');
otherTxtbox.value = currentTxtBox.value;
}
<asp:textbox id="bla" runat="server" onchange="ChangeValue(this)" />
<asp:textbox id="otherTxtbox " runat="server" />
您能更具体一点吗?如何改变?所需的值是什么?因此,为了澄清,用户提交表单->文本框的值根据提交时文本的内容而变化?它是如何改变的?真的很难理解你在这里想要实现什么。你能详细编辑你的问题吗?你能说得更具体些吗?如何改变?所需的值是什么?因此,为了澄清,用户提交表单->文本框的值根据提交时文本的内容而变化?它是如何改变的?真的很难理解你在这里想要实现什么。你能详细修改你的问题吗