在表单上实时更新值 [英] Real time updating of values on a form

查看:111
本文介绍了在表单上实时更新值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与我的其他问题略有关系(已回答)这里,我是想要下面是可能的(它可能是非常基本的,但我有点noobish在JavaScript)!



所以我有2个输入字段,用户键入东西变成一种形式。他们按计算,然后功能总计了他们已经输入,然后分别计算1,2和3%的每个值。它看起来像这样:



输入1%的值

输入2%值

输入3%值

总计



我有办法能够实时更新表单吗?所以我的意思是,一旦用户输入一个值到一个字段,该功能会自动开始更新的值,如总等等?



感谢



Kiz

p>

解决方案

如果你想显示'realtime'(意思是用户键入)值,你可以使用键值: p>



回答:



最大


Slightly related to my other question (which was answered) here, I was wondering if the following was possible (it likely is and very basic but I'm a bit noobish at JavaScript)!

So I have 2 input fields where the user types something into a form. They press "calculate" and then the function totals up what they have entered and then calculates 1,2 and 3% for each value respectively. It looks something like this:

input 1%value
input 2%value
input 3%value
total total

Is there a way for me to be able to update the form in real time? So by this I mean, as soon as the user enters a value into a field the function automatically starts updating the values such as total etc? How would I go about achieving this, can it be done purely in JavaScript?

Thanks

Kiz

解决方案

If you want to display 'realtime' (meaningly, as the user types) values, you can use the keyup values :

Regards,

Max

这篇关于在表单上实时更新值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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