单击“提交”按钮后如何识别特定文本字段中的值更改 [英] how to identify the changing of value in a particular text field after clicking submit button

查看:119
本文介绍了单击“提交”按钮后如何识别特定文本字段中的值更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

i want to update marks of a particular student in particular subject out of eight subjects.

know my question is how to identify that the particular text box value has been changed after clicking submit button there by the updation task is forwarded to the update.php. please give me your valuable answer. thanks in advance.

NOTE: all the eight text boxes have similar id.

推荐答案



我建议你去的是下面的代码:

假设,我们有这种设计


what i can suggest you to go by is the code like below:
suppose,we have this sort of design
<div id="testTextDiv">
                   <input type="text" value="" onclick="changedValue(this.value,1);"  />
                   <input type="text" value="" onclick="changedValue(this.value,2);" />
                   <input type="text" value="" onclick="changedValue(this.value,3);" />
                   <input type="text" value="" onclick="changedValue(this.value,4);" />
                   <input type="text" value="" onclick="changedValue(this.value,5);" />
                   <input type="text" value="" onclick="changedValue(this.value,6);" />
                   <input type="text" value="" onclick="changedValue(this.value,7);" />
                   <input type="text" value="" onclick="changedValue(this.value,8);" />
                   <input type="text" value="" onclick="changedValue(this.value,9);" />
                   <input type="hidden" value="" id="hdnField" />
                   <input type="button" value="Submit" onclick="CalculateValue('testTextDiv');" id="testText" />
               </div>





和脚本根据文本框获取旧的和最新的值,我们可以继续/>



and script to get the old and latest values according to the textbox,we can proceed lik-

function CalculateValue(obj) {
           var values = 0;
           var changedValue = 0;
           var changedIndex = 0;
           var objArray = "";

           if (


'' #hdnField')。length > 0 ){
objArray =
('#hdnField').length > 0) { objArray =


' #hdnField' )VAL();
var changedValue =(objArray.split(' @'))[ 0 ];
var changedIndex =(objArray.split(' @'))[ 1 ];
if (changedValue!= ' '){
('#hdnField').val(); var changedValue = (objArray.split('@'))[0]; var changedIndex = (objArray.split('@'))[1]; if (changedValue != '') {


这篇关于单击“提交”按钮后如何识别特定文本字段中的值更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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