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?

Recommended Answers

All 6 Replies

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?

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.

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

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>

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.

smug mode engaged Youre welcome smug mode cancelled

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.