I need some help from you all..
我需要你们的帮助..
Actual Scenario is : This is Module to Update today's price of products and there are seven TextBoxes created in loop with
实际场景是:这是更新今天产品价格的模块,并且循环创建了七个TextBox
<input type="text" id="<?="rate2".$i?>" name="<?="rate2".$i?>" size="5" />
($i is increment variable of loop) also I already got abc rate (Standard price).
($ i是循环的增量变量)我也已经获得了abc rate(标准价格)。
Now Problem is : Whenever user enters the value on 1 TBX it should compare this.value with abc rate and if this.value is low then entire row's text color should be red, so on. then finally, it should also highlight the lowest of all.
现在问题是:每当用户在1 TBX上输入值时,它应该将this.value与abc rate进行比较,如果this.value为低,则整行的文本颜色应为红色,依此类推。最后,它应该突出最低点。
Please help me in this asap Thanks in advance...
请尽快帮助我,谢谢...
1 个解决方案
#1
1
using jQuery it could be something like this :
使用jQuery它可能是这样的:
<input type="text" id="<?="rate2".$i?>" name="<?="rate2".$i?>" size="5"
onkeypress="if( parseInt($(this).val()) < abc )$(this).css('background-color','red')"/>
Add a function at Prototype :
在Prototype中添加一个函数:
Array.prototype.min = function() {
var r = this[0];
this.forEach(function(v,i,a){if (v<r) r=v;});
return r;
};
var items = [];
$('input:test').each(function(){
items.push($(this).val());
});
var lowest = items.min;
$("input:text[value='"+min+"']").css('background-color','blue');
#1
1
using jQuery it could be something like this :
使用jQuery它可能是这样的:
<input type="text" id="<?="rate2".$i?>" name="<?="rate2".$i?>" size="5"
onkeypress="if( parseInt($(this).val()) < abc )$(this).css('background-color','red')"/>
Add a function at Prototype :
在Prototype中添加一个函数:
Array.prototype.min = function() {
var r = this[0];
this.forEach(function(v,i,a){if (v<r) r=v;});
return r;
};
var items = [];
$('input:test').each(function(){
items.push($(this).val());
});
var lowest = items.min;
$("input:text[value='"+min+"']").css('background-color','blue');