Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/447.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 动态设置输入框的值_Javascript_Asp.net - Fatal编程技术网

Javascript 动态设置输入框的值

Javascript 动态设置输入框的值,javascript,asp.net,Javascript,Asp.net,我有一个带有输入文本框控件的aspx页面,我想为其设置一个值。我希望它能够在提交表单时根据文本框的当前文本动态更改值。有人知道在没有jquery的情况下如何做到这一点吗?我想这正是您想要的,但不确定: JavaScript: function ChangeValue(currentTxtBox, newValue) { var otherTxtbox = document.getElementById('<%=otherTxtbox.ClientID%>'); o

我有一个带有输入文本框控件的aspx页面,我想为其设置一个值。我希望它能够在提交表单时根据文本框的当前文本动态更改值。有人知道在没有jquery的情况下如何做到这一点吗?

我想这正是您想要的,但不确定:

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" />

我想这就是你想要的,但我不确定:

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" />


您能更具体一点吗?如何改变?所需的值是什么?因此,为了澄清,用户提交表单->文本框的值根据提交时文本的内容而变化?它是如何改变的?真的很难理解你在这里想要实现什么。你能详细编辑你的问题吗?你能说得更具体些吗?如何改变?所需的值是什么?因此,为了澄清,用户提交表单->文本框的值根据提交时文本的内容而变化?它是如何改变的?真的很难理解你在这里想要实现什么。你能详细修改你的问题吗