Javascript counter

Asked

Viewed 58 times

1

I have a pdf form that already has a javascript that if it is inserted a value different from the predetermined one the font turns red, and if it is within the limits determined the font turns green.

I would like to insert three fields of counters, one with the number of fields in red and the other with the number of fields in green, and a third field with the total number of fields (green + red). You can do it ?

Code I use to do the coloring.

var v = Number(event.value);
  if (v>=10.720 && v<=10.780)
    event.target.textColor = color.green;
  else event.target.textColor = color.red;
  • Artur, ter tem. But it would be easier to help you if you post your code (html and js).

  • pdf form? How would that be? News for me.

  • Diego, the code I use is this one: var v = Number(Event.value); if (v>=10.720 && v<=10.780) Event.target.textColor = color.green; Else Event.target.textColor = color.red; then needed to create a new code to count the amount of fields in red and the amount of fields in green.

  • @Arthur edits and asks with your code. I’ll put it for you, but do it next time.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.