Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function update_subs(yesterday_string){ //yesterday_string -строка с датой
- $('#positions-table tbody tr').each(function(i) {
- var that = this;
- $(this).children("td:gt(4)").each(function(j){
- var today_string = $('#positions-table th:eq('+(5+j)+')').html();
- today = result["rows"][i][today_string];//получаем по i j
- yesterday = result["rows"][i][yesterday_string];//допустим у нас есть i, но как правильно найти столбец?
- if (today > "0" && today < "999" && yesterday > "0" && yesterday < "999"){
- var today_int = parseInt(today,10);
- var yesterday_int = parseInt (yesterday,10);
- if (yesterday_int-today_int>0){
- $(this).append("<sub style='color:green;'>+"+(yesterday_int-today_int)+"</sub>");
- }
- if (yesterday_int-today_int<0){
- $(this).append("<sub style='color:red;'>"+(yesterday_int-today_int)+"</sub>");
- }
- if (yesterday_int-today_int==0){
- $(this).append("<sub style='color:yellow;'>"+(yesterday_int-today_int)+"</sub>");
- }
- }
- });
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement