0

Hi

When I try this if in IE 9 with my variabels like:
maxGrootte = 12 and minGrooote = 5 it enters into the if condition

    if(maxGrootte < minGrootte){
        bericht += "\t -Het minimum aantal deelnemer kan nooit groter zijn dan \n";
        bericht +="\t  het maximum aantal deelnemers\n";
        status= false;
    }

When I use Firefox it works perfect.
Has someone had this problem before?

Edited by nevek

2
Contributors
6
Replies
16
Views
2 Years
Discussion Span
Last Post by DaveAmour
0

It is far more likeley that you have done something wrong.

For example you have two spellings of minGrooote there. One with one t and one with two ts.

Can you show me the code where you declare and assign values to these two variables?

0

Hi
That minGrooote is a typo, but it doesn't matter because I just use it to set an example.
When I check in the debugger with F12 in IE I can see that maxGrootte has the value 12 and minGrootte has the value 5.

Edited by nevek

0

Show me your code though please - there is something wrong with it but I can't fix it unless you show it to me.

0

Ok I am going to attempt to solve this even without seeing your code even though that goes against my scientific nature.

Do you by any chance have JavaScript thinking your variables are strings and not numbers?

Did you do something like this maybe?

http://www.paxium.co.uk/content/daniweb/ifstatement.html

<body>
    <script>
        $(document).ready(function()
        {
            var maxGrootte = $("#t1").val();
            var minGrootte = $("#t2").val();

            if(maxGrootte < minGrootte)
            {
                alert(maxGrootte + " is less than " + minGrootte);
            }
            else
            {
                alert(maxGrootte + " is not less than " + minGrootte);
            }            
        });
    </script>

    <input type="text" id="t1" value="12" />
    <input type="text" id="t2" value="5" />
</body>

Edited by DaveAmour

0

Thanks DaveAmour for the hint
I had

var minGrootte=therapie.txtMinGroote.value;
var maxGrootte=therapie.txtMaxGroote.value;

if(maxGrootte < minGrootte){
        bericht += "\t -Het minimum aantal deelnemer kan nooit groter zijn dan \n";
        bericht +="\t  het maximum aantal deelnemers\n";
        status= false;
  }

and now I have

var minGrootte=therapie.txtMinGroote.value;
var maxGrootte=therapie.txtMaxGroote.value;

 if(Number(maxGrootte) < Number(minGrootte)){
        bericht += "\t -Het minimum aantal deelnemer kan nooit groter zijn dan \n";
        bericht +="\t  het maximum aantal deelnemers\n";
        status= false;
  }

and it works :) , The casting to number did it.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.