0

in if condition i get value max 10 min 9 when compare its true and exe how its possible

    for(var r=1;r<n;r++) 
    {  c=0;
       max=table.rows[r].cells[c].innerHTML;
       if (max<minimum) 
       {  
         alert("if max"+max+" minimum"+minimum );
         minimum = max;
         alert(minimum);
         location = r+1;
       }
       else
       { 
          minimum=minimum;
          alert("else minimum"+minimum);``
       }
    }
}

Thank you

give me solutions to find correct answer or else i need code for highlight in table cell which cells are all have minimum value in a table

2
  • when and how you init "minimum"? Commented Jul 18, 2014 at 11:27
  • 2
    minimum=minimum; makes no sense... Commented Jul 18, 2014 at 11:28

2 Answers 2

1
max=table.rows[r].cells[c].innerHTML;

InnerHTML is a string. In order to do comparison you need to convert it to a number with parseInt or parseFloat

max = parseInt(table.rows[r].cells[c].innerHTML);
Sign up to request clarification or add additional context in comments.

Comments

0

You have to use parseInt() method because the verification will be done on a string:

max=parseInt(table.rows[r].cells[c].innerHTML);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.