为输入字段分配一个值 [英] Assigning a value to Input field

查看:71
本文介绍了为输入字段分配一个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

假设我有一个标签和1个隐藏字段.标签具有一些值,我想为该隐藏字段分配相同的值.我的代码就是这样.

HI all,

Suppose I have one label and 1 hidden field. label is having some value and I want to assign the same value to that hidden field. My code is like this.

<asp:label id="Amount" runat="server" text="1000" xmlns:asp="#unknown"></asp:label>
<input type="hidden" name="Amount" value=""></input>



我应该在值字段中写些什么来为输入分配值?

我想分配与Label相同的值,即1000

在此先感谢.



What should I write in value field to assign value to input?

I want to assign the same value as Label ie 1000

Thanks in advance.

推荐答案

如果仅从服务器端进行操作,则不会有任何问题,因为以相同的方式分配标签将相同的值分配给隐藏变量.
首先将一些id放在hiddenvariable中.现在,如果您要从javascript更新标签,则同时需要将hidden变量更新为
document.getElementById(hiddenvariableid).value = updatedvalue
if you are doing from server side only then you should not be having any problem because as you are assigning to label in the same way you can assign the same to hidden variable.
First put some id in hiddenvariable Now if you are updating label from javascript then at the same you need to update the hidden variable as
document.getElementById(hiddenvariableid).value = updatedvalue


这篇关于为输入字段分配一个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆